xjq233p_1
xjq233p_1

Reputation: 8060

Django Time issues

My app in django requires to tell the user what time an action occurred. Aside from asking the user what timezone he/she is in, is it possible for me to generate the time on the client end?

Off the top of my head, are there a particular representation of time that is timezone independent, (unix time?), and then I can simply paste it into the html and have the client end (browser) findout the timezone and then do the calculation?

Upvotes: 2

Views: 287

Answers (3)

zsquare
zsquare

Reputation: 10146

Haven't used it myself, but I think this is what you are looking for.

Upvotes: 2

Steve Jalim
Steve Jalim

Reputation: 12195

I'd make all my times UTC, as that's a good international-level reference point, and you can always shift that to a local time, given that you know the user's TZ.

I'd also use the time on the server (datetime.datetime.now()) rather than rely on the client's system clock, as this makes it easy to fake what time something happened at.

Upvotes: 2

mouad
mouad

Reputation: 70021

i think you are looking for L10n (localization) yes ???

Upvotes: 1

Related Questions