data type conversion

is it possible to convert date object to string object. if yes how to convert.
[85 byte] By [RaviKumar.Avulaa] at [2007-11-27 5:41:07]
# 1

/**

* Returns the Current Date and Time in String Format

*/

public static String returnDateAndTime() {

Date d = new Date();

String Nowdate = DateFormat.getDateTimeInstance().format(d);

return Nowdate;

}

/**

* Translates any long value to its respective date and time

*/

public static String returnDateAndTime(long currentTime) {

return DateFormatUtils.format(currentTime, "dd-MMM-yyyy HH:mm:ss");

}

u also need to import the following packages

import java.util.*; //for manipulating the time

import java.text.*;

import org.apache.commons.lang.time.*; // formatting numbers

sridanua at 2007-7-12 15:18:13 > top of Java-index,Java Essentials,New To Java...
# 2
Here is one of many ways. Date today = new Date(System.currentTimeMillis());String s = today.toString();When in doubt always try the toString method.
_helloWorld_a at 2007-7-12 15:18:13 > top of Java-index,Java Essentials,New To Java...