on 03-04-2008 11:47 PM
Hi,
Right now, In my applicaiton a timestamp value is inserted to Database table. But as of now it inserts current time stamp.
If the time zone is other than pacific zone. Can any one let me know how to format the time zone.
what can I do to make this value to timestamp from pacific zone.
java.util.Date utilDate = new java.util.Date();
java.sql.Timestamp sqlDate = new java.sql.Timestamp(utilDate.getTime());
sqlDate is the value which I am inserting.
this sqlDate needs to be in pacific zone timestamp.
Thanks,
James.
Hi,
Check following code.
This code changes the pattern of the date anc time zone.
TimeZone tz = TimeZone.getTimeZone("GMT+05:30");
SimpleDateFormat formatter =(SimpleDateFormat)DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.LONG, Locale.US);
formatter.setTimeZone(tz);
formatter.applyPattern("MM/dd/yyyy");
Hope it helps you.
Regards
Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.