Today I met an problem when doing the test in the server from different timezone:
- After saving the object and then display it, it’s displayed as ‘2015-9-30 23:00:00’. And every time after doing this, we have 1 hour difference.
Then I realize this should be a timezone issue and check the document:
“When populating the date and no timezone is specified, it default to use the local timezone from the client browser”.
Since our QA server is from different timezone, we always has the 1 hour difference.
We could have multiple solutions for this. But our requirement is pretty straightforward, we just want no matter which date the client selected, we have the same value saved to database. So I changed the value that we passed to server to be a string value(like ‘2015/10/1’) and parse the date from server side, instead of using the datatime long value.
There also some other solution referred: