I'm creating an application that requires dates & times to be stored. Currently, I'm creating a time like this:
Time.strptime("2013-12-08 04:15pm PST", "%Y-%m-%d %H:%M%P %Z")
=> 2013-12-09 00:15:00 +0000
I'm cool with storing this in the database, but my question is about daylight savings time. When I do this:
Time.strptime("2013-06-08 04:15pm PST", "%Y-%m-%d %H:%M%P %Z")
=> 2013-06-09 00:15:00 +0000
It doesn't seem to have adjusted itself for daylight savings. Am I wrong in thinking this? How can I know that when I create a object with a time attribute that I'll be able to retrieve that exact time in the future?
How can I best read the string date from a user, save it in utc in the database, and retrieve it later to display exactly without worrying about DST?
I know a lot of answers say to use the config.time_zone in rails, but my application will eventually be cross-timezone.