Friday, 15 April 2011

java - issue with timezone while saving date through screen in gwt -



java - issue with timezone while saving date through screen in gwt -

i using gwt application. server in application deployed , database using in paris (france). in application have provision come in date saved db.

when application launched paris, working fine. when same application launched india, date entered on screen stored 1 day less entered. example, in republic of india come in 16/07/2014 theb date stored 15/07/2014.

i suspect geographical problem. there code changes need save date accommodation timezone? or scheme date on computer user using application?

my favorite approach save dates long values adjusted midnight in gmt:

long dateinmills = new date().gettime(); dateinmills -= dateinmills % (24 * 60 * 60 * 1000)); // show date can use, illustration datetimeformat.getformat(predefinedformat.date_medium).format(new date(dateinmills));

when show date in gwt, utilize default time zone of browser display it.

if want have more command on it, illustration allow user 1 time zone in browser see dates different time zone, have pass desired timezone object datetimeformat#format method.

java gwt

No comments:

Post a Comment