I want to store datetime strings in my SQL database. And some of these may be timezone-aware. I have 3 ways of storing them:
- Storing them as a string without timezone, such as - '1995-01-13 12:41:04.231132', and storing the timezone offset- '+0000'in a separate column.
- Storing them as a string without timezone, such as - '1995-01-13 12:41:04.231132', and storing the timezone name- 'Africa/Cairo'in a separate column.
- Storing the entire thing as a string: - '1995-01-13 12:41:04.231132+0000', with the offset attached.
What would be the ideal way to do this?
Note: I am using PostgreSQL database.
Extra details: I am in fact storing these datetimes in a JSONB column in my PostgreSQL database, so during queries and ordering, I need to cast these using the appropriate data type.
 
    