Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
156
rated 0 times [  159] [ 3]  / answers: 1 / hits: 47957  / 9 Years ago, wed, september 9, 2015, 12:00:00

I send this date from my controller in java (Spring-MVC) the type in mysql is datetime



@Temporal(TemporalType.TIMESTAMP) 
@Column(name = ..) public Date getYy() {
return this.yy;
}


as : [2015-09-30 00:00:00.0]



When i get this dates with ajax as 1443567600000 :



new Date(1443567600000) convert to Tue Sep 29 2015 23:00:00 GMT+0000 (Maroc)



So why i get wrong date off by one hour?



SOLUTION



We resolve it by



d = new Date(value) ;
d.setTime( d.getTime() - new Date().getTimezoneOffset()*60*1000 );


because it was Daylight saving time (DST) or summer time problem. good article


More From » java

 Answers
1

I think maybe this is a Daylight Saving Time problem. You can check your client's timezone, and your server's timezone. (web server or SQL Server)


[#65133] Monday, September 7, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
susand

Total Points: 690
Total Questions: 101
Total Answers: 104

Location: Lesotho
Member since Wed, Jun 2, 2021
3 Years ago
;