Take the 2-minute tour ×  I have a Rails 3 application on Ruby
1.9.2 in which users enter business hours and they are stored in
a MySQL database. When a user does this, however, the entered
time "8:00 AM" gets stored as 3pm in the database. I want it to
be stored as they entered it, regardless of time zone. I figured
the best way to do this is to set everything to UTC and have it
ignore my time zone (Arizona), but Rails seems to be ignoring my
setting. Example:  Time.zone = 'UTC'  mon_open_date =
Time.parse(params[:venue][:mon_open_at]) rescue nil  # =>
2011-04-27 08:00:00 -0700  The result in MySQL:  | mon_open_at |
| 15:00:00    | 1 row in set (0.00 sec)  Any ideas?
share|improve this question add comment  2 Answers  up vote 4
down vote accepted  Time.parse always parses the string into
your computer's local timezone. You need to use Time.zone.parse
in order to parse it as the specified timezone, UTC.
share|improve this answer That did the trick, thanks! – 
huertanix Apr 27 '11 at 12:09 add comment  MySQL