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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:56:32+00:00 2026-06-09T15:56:32+00:00

Very strange error indeed. I have an item that clones itself every month, setting

  • 0

Very strange error indeed. I have an item that clones itself every month, setting the next object to have a scheduled_on date, + 1.months in the future.

But then this happened :

Sun, 01 Apr 2012 16:00:00 PDT -07:00
Tue, 01 May 2012 16:00:00 PDT -07:00
Fri, 01 Jun 2012 16:00:00 PDT -07:00
Sun, 01 Jul 2012 16:00:00 PDT -07:00
Wed, 01 Aug 2012 16:00:00 PDT -07:00
Fri, 31 Aug 2012 17:00:00 PDT -07:00 # <--- What in the..

The code :

def clone_object
  objects = []

  Time.zone = account.timezone
  Chronic.time_class = Time.zone

  now = last_scheduled_on.to_time # <- this would have been Wed, 01 Aug 2012 16:00:00 PDT -07:00

  new_date = now + 1.months

  new_schedule = Time.zone.parse new_date.strftime('%Y-%m-%d' + ' ' + original_scheduled_on.strftime('%H:%M:%S'))

  objects << clone!(:scheduled_on => new_schedule, :recurring_job_id => id)

end

That is a very truncated version of the actual code. But it includes all the parts that I are reasonably affecting this issue.

So the question is.. how could that error could have possibly occurred?

Update

I’m pretty sure this is timezone related.

Here’s the Dates in UTC:

In UTC :

Sun, 01 Apr 2012 23:00:00 UTC +00:00
Tue, 01 May 2012 23:00:00 UTC +00:00
Fri, 01 Jun 2012 23:00:00 UTC +00:00
Sun, 01 Jul 2012 23:00:00 UTC +00:00
Wed, 01 Aug 2012 23:00:00 UTC +00:00
Sat, 01 Sep 2012 00:00:00 UTC +00:00
Sun, 30 Sep 2012 23:00:00 UTC +00:00

Here they are converted to Pacific :

In Pacific

Sun, 01 Apr 2012 16:00:00 PDT -07:00
Tue, 01 May 2012 16:00:00 PDT -07:00
Fri, 01 Jun 2012 16:00:00 PDT -07:00
Sun, 01 Jul 2012 16:00:00 PDT -07:00
Wed, 01 Aug 2012 16:00:00 PDT -07:00
Fri, 31 Aug 2012 17:00:00 PDT -07:00
Sun, 30 Sep 2012 16:00:00 PDT -07:00

I also noted that the code I put here in not accurate to my server. The server has the Time.zone set to the last job and not the account’s timezone. This means ( or at least I think it means ), that the timezone is then floating and dynamic. But that bothers me also because Daylight savings time in California does not switch over until November, not September.

  • 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-09T15:56:34+00:00Added an answer on June 9, 2026 at 3:56 pm

    The reason this is occurring is because when you add two DateTime’s, the DateTime object will add by number of days and discredit timezones.

    When you add two Time objects together, they will add by the hour, and include any timezone differences.

    The hour difference occurred specifically because two DateTime’s were added together that transgressed over a Timezone change. The time then is saved to the database in UTC as the same number despite the fact that when they are later parsed in their respective timezone’s, they will be offset by one hour.

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

Sidebar

Related Questions

I have a very strange error happening in an App that has been working
I have a very strange error. I have an webpage that runs in Appmode
I have just started getting a very strange error when using jQueryMobile for my
it is very strange, because this error doesn't happen all the time... I have
I have an very strange error: when I want to use the SocialServer::Client class
This error very strange. I have a bunch of properties in app delegate which
I have very strange error I can't understand. I started a new project throw
I got a very strange error on my android apk that only appears if
Very strange error, i have a field on an MVC View: <%: Html.CheckBox(Reportable, ViewData[Reportable])%>
i find that spring security, session concurrency is very strange. <sec:session-management> <sec:concurrency-control max-sessions=1 error-if-maximum-exceeded=true

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.