Storing date and time as epoch vs native datetime format in the database
- by zakovyrya
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?