cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Time Zone to Pacific Zone US

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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