How can I store a datetime with SQLAlchemy? Should I even be using DateTime as the column type?

At the moment my date + time is in ISO format from the client (Javascript):

2015-04-13 01:00:00

How would I store this as UTC on the server? Would it be better to have a unix timestamp from the Javascript?

share|improve this question

Javascript provides Time based on user / client timezone. Thus the time that you get in Javascript will vary as per the user location.

You will have to get the time and client timezone : refer get client timezone and convert it to gmt Then change the time as per UTC and pass it to server and save it in database

Else refer: UTC date and time to get the UTC date / time objects of the client time , form its ISO format and pass it to server n save in DB.

Saving date and time in UTC helps converting time based on user timezone when ever required.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.