Reputation: 3821
I am using following specifications in my current project (production)
The database is in separate server than application server but both are in same LAN.
Datatype in mysql table is: date
for storing date only and datetime
for saving date along with time.
The problem is mysql saved every date 1 day earlier than the date provided from applcation. I have tried the following till now but still no luck:
What am I missing? Can anybody suggest?
Upvotes: 5
Views: 4901
Reputation: 1
Maybe you can try changing the serverTimezone
:
serverTimezone=GMT%2B8
Upvotes: -1
Reputation: 3821
Thanks to all for sharing your experience regarding the issue.
At last, I solved it by changing the serverTimezone
attribute of mysql connection string in dispatcher-servlet
of my java web application.
<property name="url" value="jdbc:mysql://x.x.x..x:3306/dbname?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Dhaka" />
Upvotes: 2