java - Spring MVC Daylight saving issue -


i've working on spring mvc quite time , bumped problem

i set application timezone new_york following code:

public class applicationlistenerbean implements applicationlistener {      @override     public void onapplicationevent(applicationevent event) {         if (event instanceof contextrefreshedevent) {             timezone.setdefault(timezone.gettimezone("america/new_york"));             system.out.println("eastern time zone");         }     } } 

next, i'm submitting form , reading code:

@requestmapping("/saveschedule") @responsebody public string saveschedule( @modelattribute commonschedule schedule, modelmap map, httpservletrequest request) {      system.out.println(">>>>>>>>>>>>>>>>          " + schedule.getsendingtime());     system.out.println(new date()); } 

if select time, 15:30:00, i'm getting output i'm getting following output:

>>>>>>>>>>>>>>>>          thu jan 01 05:30:00 est 1970 mon aug 26 06:20:01 edt 2013 

i want know, how come spring mvc form submission getting est whereas application edt

i want know, how come spring mvc form submission getting est whereas application edt

you're using america/new_york time zone, alternates between est , edt daylight saving time changes occur.

when use time without date, you're implying date of 1/1/1970 - america/new_york in est @ time.

you should instead applying time particular date use correct offset time.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -