Storing date and time as epoch vs native datetime format in the database

Posted by zakovyrya on Stack Overflow See other posts from Stack Overflow or by zakovyrya
Published on 2010-04-12T17:23:19Z Indexed on 2010/04/12 17:43 UTC
Read the original article Hit count: 338

For most of my tasks I find it much easier to work with date and time in the epoch format:

  • it's trivial to calculate timespan
  • or determine if some event happened before or after another,
  • I don't have to deal with time-zone issues if the data comes from different geographical sources,
  • in case of scripting languages what I usually get from database when I request a datetime-typed column is a string that I need to parse in order to work with it.
  • This list can go on, but for me in order to keep my code portable that's enough to ditch database's native datetime format and store date and time as integer. What do you guys think?

    © Stack Overflow or respective owner

    Related posts about datetime

    Related posts about epoch