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

  • Home
  • SEARCH
  • 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 7506357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:14:05+00:00 2026-05-29T22:14:05+00:00

When a record is updated or created in MYSQL, the timestamp property stores the

  • 0

When a record is updated or created in MYSQL, the timestamp property stores the time and subtracts 0530hrs from the current system time. I want it to store the system time as is.

Below is one of such tables:

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string   :username
      t.string   :first_name
      t.string   :last_name
      t.timestamps 
    end
  end

t.timestamps creates two extra fields: created_at and updated_at. These fields are storing the time, which is not according to the system time.

Some data from the database

ID    ENo       Name   created_at                      updated_at
38    EMP1      Puja   2012-02-16 05:05:15.650740      2012-02-17 04:58:01.728120

The actual creation time was 10:35:15 AM on 16th feb 2012 and the update time was around 10:28 AM on 17th Feb.

What are the changes required to my application to achieve this?

  • 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-05-29T22:14:06+00:00Added an answer on May 29, 2026 at 10:14 pm

    Rails always stores DateTime fields in UTC (Universal Time Coordinated). If you set the following option in the application.rb

    config.time_zone = 'Central Time (US & Canada)' # UTC-5 
    

    the dates will still be saved in UTC at the database level but will be translated when you access them.

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

Sidebar

Related Questions

I want to update a field with the current timestamp whenever the row is
I have a MySQL 5 database that is updated every 5 minutes from a
I need to update a record in the datastore, but instead of updated record
Ruby on Rails has magic timestamping fields that are automatically updated when a record
How do I track or get notified whenever a record is inserted or updated
I want to have an 'updateinfo' table in order to record every update/insert/delete operations
i am connecting to mysql from excel using odbc. the following illustrates how i
I have a function that updates a MySQL table from a CSV file. The
I have mysql table with data like this. record will have server with total
I am developing a MySQL database using Workbench. I want two send two fields

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.