import java.util.*;
class PrintDate{
public static void main(String args[])
{
Date d=new Date();
System.out.println(d);
System.out.println(TimeZone.getDefault());
}
}
The output of the program and the shell command 'Date' are differed by one hour, did anybody face this problem. What can be the solution.?
$ java PrintDate
Thu Aug 13 09:02:21 GMT+05:30 2009
sun.util.calendar.ZoneInfo[id="GMT+05:30",offset=19800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
$ date
Thu Aug 13 10:02:36 IST 2009
$ echo $TZ
IST-5:30IST
Edited by: RaghuD on Aug 12, 2009 10:03 PM
Edited by: RaghuD on Aug 12, 2009 10:03 PM