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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:21:48+00:00 2026-05-31T20:21:48+00:00

I am trying to select items between two dates. Time.zone.now seems to respect the

  • 0

I am trying to select items between two dates. Time.zone.now seems to respect the zone value but when called as part of Active Record, it doesn’t. I am not storing my data as UTC so specifying as Time.zone.now should bring back the time of the current specified zone. How do I make this work correctly? What is the logic of the thinking?

thx

ruby-1.9.2-p290 :009 > Time.zone.now
 => Thu, 22 Mar 2012 22:26:43 PDT -07:00 
ruby-1.9.2-p290 :010 > Event.where(:start_datetime => (Time.zone.now)..(Time.zone.now.end_of_day))
  Event Load (0.5ms)  SELECT `events`.* FROM `events` WHERE (`events`.`start_datetime` BETWEEN '2012-03-23 05:26:59' AND '2012-03-23 06:59:59')
 => [] 
ruby-1.9.2-p290 :011 > 
  • 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-31T20:21:49+00:00Added an answer on May 31, 2026 at 8:21 pm

    Try the things like :

    Event.where(:start_datetime => (Time.now.in_time_zone(YOUR_TIME_ZONE))..(Time.zone.now.end_of_day.in_time_zone(YOUR_TIME_ZONE))
    
    YOUR_TIME_ZONE like "Eastern Time (US & Canada)"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add items to a select drop down at run time. So
I've been trying to select an item on an external listview but it seems
I'm trying to select cpu_time from the db, but the time must correspond with
I'm trying to put an image as a separator between menu items but not
I'm trying to convert this SQL query to LINQ: SELECT Items.p_Name Product, DiamondCategory.dc_Name Category,
I'm trying to use XPath to select the items which have a facet with
I'm trying to figure out how to exclude items from a select statement from
I'm trying to implement a hasone relationship between 2 models, but I can't have
When I selected some item in combobox and then I'm trying to select another
Trying to select anchor tags that are a descendants of a div with a

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.