简体   繁体   中英

timeago jquery plugin problem

I am using timeago jquery plugin to show nice dates for the users, The problem I found is that my server is 6 hours far from my time zone, so if I added a record in the db and it save the current time, it saves the current server date time, so when I get the date again I see it late 6 hours than it should look.

For example I have this table in db:
Id, Name, CreatedOn
I insert a new record and Created is automatically get the current date using my server side c# code.

When I get this record to show in the browser I see it 6 hours late.

How to solve this issue, from the server side or the client side will be better and how.

Do not save "current time", rather save UTC equivalent of current time.

Send this UTC time to browser and let the browser to convert in specific local time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM