import java.text.SimpleDateFormat;
import java.util.Date;
public class DateTest
{
public static void main(String[] args)
{
Date myDate=new Date(System.currentTimeMillis());
//This time format is your local time format.
System.out.println(myDate.toString());
//Used the simple format to get the String you want .
//The valid string ,you can reference the JDK Doc
SimpleDateFormat sDateFormat=new SimpleDateFormat("yyyy/MM/DD HH:mm:ss");
System.out.println(sDateFormat.format(myDate));
}
}