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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:21:59+00:00 2026-05-25T03:21:59+00:00

I have a cron task that runs once a day, using Heroku’s Daily Cron

  • 0

I have a cron task that runs once a day, using Heroku’s Daily Cron addon. The cron takes values from yesterday’s data and creates required objects with today’s timestamp. But, I am facing unusual circumstances. This is from Heroku console :

>> Date.today
=> Thu, 25 Aug 2011
>> Date.yesterday
=> Thu, 25 Aug 2011
>> DateTime.now
=> Thu, 25 Aug 2011 23:31:42 -0700

The current time being 23:31, I thought of giving it a try later on. This is what I have now :

>> Date.today
=> Fri, 26 Aug 2011
>> Date.yesterday
=> Thu, 25 Aug 2011
>> DateTime.now
=> Fri, 26 Aug 2011 00:35:14 -0700

Any ideas why Date.today and Date.yesterday provide the same result. Is it due to the timezone or other certain settings ?

Thanks

  • 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-25T03:22:00+00:00Added an answer on May 25, 2026 at 3:22 am

    Date.today represents date according to your server time irrespective of the time zone that you have set.

    Date.yesterday is Time.now.in_time_zone – 1.day. It depends on Time.zone that we have set

    This example should clarify it:

    ruby-1.9.2-p180 :014 > Time.now => 2011-08-26 03:21:10 +0545

    ruby-1.9.2-p180 :015 > Time.zone => (GMT+00:00) UTC

    ruby-1.9.2-p180 :016 > Time.now.in_time_zone => Thu, 25 Aug 2011 21:36:40 UTC +00:00

    ruby-1.9.2-p180 :018 > Date.yesterday => Wed, 24 Aug 2011

    ruby-1.9.2-p180 :017 > Date.today => Fri, 26 Aug 2011

    Now,after setting time-zone as Kathmandu. Date.yesterday changes as expected but there is no change to Date.today

    ruby-1.9.2-p180 :019 > Time.zone="Kathmandu" => "Kathmandu"

    ruby-1.9.2-p180 :022 > Time.now.in_time_zone => Fri, 26 Aug 2011 03:55:28 NPT +05:45

    ruby-1.9.2-p180 :020 > Date.yesterday=> Thu, 25 Aug 2011

    ruby-1.9.2-p180 :021 > Date.today => Fri, 26 Aug 2011

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

Sidebar

Related Questions

I have a rake task that gets run as a cron job once a
I have a cron that for the time being runs once every 20 minutes,
I have an update query being run by a cron task that's timing out.
I have a cron entry that runs a script at a certain time each
I have a daily cron job that email PDFs to customers. I want to
I have a PHP script that runs on cron that can take up to
I have a log that gets created from a bunch of cron jobs. My
I have a shell script ( /home/user/send_report.sh ) that runs my rake task: cd
I have a cron task that logs a value in my database every 15
I have a scheduled task that runs a script on a regular basis (every

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.