Amr Elgarhy
Amr Elgarhy

Reputation: 68912

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.

Upvotes: 0

Views: 262

Answers (1)

seoul
seoul

Reputation: 864

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.

Upvotes: 1

Related Questions