I'm struggling to make a decision between timestamp and datetime. I did fint similar questions, but none gave me a definite answer.
The scenario is as follows:
- User creates an event in their calendar (using their timezone)
- Event is persised with date and time (in some "neutral" timezone)
- Another user can view this event (using their timezone)
I have to account for DST and all date & time related things. I believe dates should be stored in UTC timezone being neutral.
So my question is whether someone could provide me a workflow they utilized in this situation?
I was thinking that in PHP I would use DateTime obviously and:
- User creates an event => I take DateTime in his timezone -> convert it to timestamp (getTimestamp) and persist that way
- When some user wants to view that event => I fetch the timestamp from database -> create new DateTime object with his timezone -> set the timestamp (setTimestamp) and this way have that time displayed in his timezone
Is there any drawback of my workflow?
I will be using Symfony 2, so any Symfony 2 workflow would be best, but other than that I will take anything!