I am writing a Ruby script. It needs to accept time stamp from the user and then do some database queries using it. As far as I know the database is storing timestamps in UTC.
I want to let the users specify the time in following format: 2015-01-01 05:00 AM CST
From what Google tells me CST is 6 hours behind UTC, so after conversion to UTC I would expect the time to be 2014-12-31 11:00 PM UTC.
But that is not what I am seeing.
Time.strptime('2015-01-01 05:00 AM CST', '%Y-%m-%d %I:%M %P %Z').utc
prints
2015-01-01 11:00:00 UTC
Shouldn't it have printed 2014-12-31 11:00 PM UTC?
Time.strptime('2015-01-01 05:00 PM CST', '%Y-%m-%d %I:%M %Z').utc
prints
2015-01-01 11:00:00 UTC
The change from AM to PM doesn't seem to make any difference, how can that be?