S
Sting
Hello,
I have the follwing test:
static void test()
{
Date today = new Date();
Date date = new Date(30000000);
DateFormat dateFormatter;
Locale currentLocale = new Locale("en","US");
dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT,
currentLocale);
String dateOut = dateFormatter.format(date);
String todayOut = dateFormatter.format(today);
System.out.println("todayOut" + todayOut);
System.out.println("todayOut toString:" + todayOut.toString());
System.out.println("****************************");
System.out.println("dateOut" + dateOut);
System.out.println("dateOut toString:" + dateOut.toString());
}
the output is:
todayOutFeb 19, 2004
todayOut toString:Feb 19, 2004
****************************
dateOutJan 1, 1970
dateOut toString:Jan 1, 1970
I do not understand the results of dateOut : why is it Jan 1, 1970 ?
It should have been somewhere in 1971 since I had passed
30000000 to the Date ctor ; which means 30000000 seconds from 1/1/70.
any help will be appreciated.
regards,
sting
I have the follwing test:
static void test()
{
Date today = new Date();
Date date = new Date(30000000);
DateFormat dateFormatter;
Locale currentLocale = new Locale("en","US");
dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT,
currentLocale);
String dateOut = dateFormatter.format(date);
String todayOut = dateFormatter.format(today);
System.out.println("todayOut" + todayOut);
System.out.println("todayOut toString:" + todayOut.toString());
System.out.println("****************************");
System.out.println("dateOut" + dateOut);
System.out.println("dateOut toString:" + dateOut.toString());
}
the output is:
todayOutFeb 19, 2004
todayOut toString:Feb 19, 2004
****************************
dateOutJan 1, 1970
dateOut toString:Jan 1, 1970
I do not understand the results of dateOut : why is it Jan 1, 1970 ?
It should have been somewhere in 1971 since I had passed
30000000 to the Date ctor ; which means 30000000 seconds from 1/1/70.
any help will be appreciated.
regards,
sting