Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:43:26+00:00 2026-06-03T04:43:26+00:00

My MySQL is storing date time stamps in GMT, though server’s time is in

  • 0

My MySQL is storing date time stamps in GMT, though server’s time is in EST. I convert my date time to local (server’s datetime EST) before adding to MySQL but it stores it GMt instead of EST. What is wrong here?

item.update_attributes({:request_datetime => Time.parse(date+" "+time+" "+timezone).localtime}) # this becomes EST
puts Time.parse(date+" "+time+" "+timezone).localtime.to_s # prints correct time zone, EST.

mysql> SELECT request_datetime,NOW(),TIMESTAMPDIFF(MINUTE,request_datetime,NOW()) FROM items Where item='2542';
+---------------------+---------------------+----------------------------------------------+
| request_datetime    | NOW()               | TIMESTAMPDIFF(MINUTE,request_datetime,NOW()) |
+---------------------+---------------------+----------------------------------------------+
| 2012-05-05 22:30:02 | 2012-05-05 18:30:05 |                                         -239 |
+---------------------+---------------------+----------------------------------------------+
1 row in set (0.00 sec)

mysql>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:43:27+00:00Added an answer on June 3, 2026 at 4:43 am

    Rails stores all time in UTC/GMT by default, and converts it to local time as necessary, this makes it easier to get correct times irrespective of your server or to allow you to establish times on a per user basis.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the Unable to convert MySQL date/time value to System.DateTime error because
PLATFORM: PHP & mySQL I am storing the date+time in database in the following
In my LAMP application, I'm storing certain date/time stamps using the timestamp data type
Ok, I am storing a Date/Time in a MySQL TEXT field. I want to
I am storing dates in a MySQL database in datetime fields in UTC. I'm
I'm storing MySQL DateTimes in UTC, and let the user select their time zone,
I am storing the date of entry in mysql via TIMESTAMP and default value
I'm looking at this documentation http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_maketime And I KNOW I must be missing it,
Trying to convert a date & time value in the format of 07/19/2011 00:00
I'm storing a timestamp in a mysql table every time somebody visits the site

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.