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 6906001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:15:12+00:00 2026-05-27T08:15:12+00:00

In mysql db for records: 2011-12-09 07:59:00 UTC In ruby if I do Time.now

  • 0

In mysql db for records:

2011-12-09 07:59:00 UTC

In ruby if I do Time.now:

2011-12-09 03:57:46 -0800

How would I do a comparison like the following? (which isn’t working)

<% if item.exp_date < Time.now %>
    Expired
<% end %>

PS. It would be great if there a solution where I don’t have to assume if the DB has times stored ending in UTC or -0800

  • 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-27T08:15:12+00:00Added an answer on May 27, 2026 at 8:15 am

    It turns out the problem was with my use of NOW() in queries to mysql.

    Adding the following to /etc/my.cnf fixed the issue:

    [mysqld_safe]
    timezone = UTC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following records like this in MySQL RecID| LastModified 1 | 2011-10-29
I'm working on a parser in php which is designed to extract MySQL records
I have a PHP function which inserts multiple records into MySQL: function commit_purchase($asset_type_ID, $org_ID,
I am using the following InnoDB tables in mysql to describe records that can
I have records in mysql table like a a a b b and I
When i am trying to use Time.zone.now it gives me an error which shows
I have to sort MySQL records based on a unix time field. However, some
How would I go about deleting all records from a MySQL table from before
Let's assume we have MySQL table events from which we'll select a data. Now
I am using the following SQL to select records from MySQL database: SELECT *

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.