Happy New Year! 2009

Blog

The transition into a new year is a difficult one for a programmer.  When the year ends, dates don’t continue on, they restart.  It’s like driving on a race track, but the track doesn’t loop.  So when you complete a lap, you have to drive all the way back to the beginning (moving from month 12 to month 1).  This can be a big issue for developers, especially when we have to take into account Leap Years and even Leap Seconds.  With more programming languages including Date&Time classes it is sometimes easier, but there are still issues.

For example, last night (New Years Day) at around 1am, Twitterific for the iPhone wouldn’t load any tweets made before 12:00am.  Or this past week, Intelliscreen would only load weather up to the 31st of December.  Even the 30gb Zunes had an issue with the leap year.  They came out in November of 2006, giving them more than 2 years of working experience and they didn’t see this bug coming.

So developers, make sure you test for New Year’s bugs.  And consumers, if you programs didn’t crash, thank your developers.

Happy New Year, World!

On an additional note, here are my preliminary New Years Resolutions (list of projects to release):

  • Graduate Project (announcement coming soon)
  • Native iPhone Remember the Milk application
  • Icecast Log Parser (with Google Chart API)
2 Comments

2 Comments

  1. Mark Kobulnick  •  Jul 12, 2010 @8:45 am

    Leap years are a pain. I had to write a Crystal Report when I started this job. As per our contract, we are entitled to “Bonus Vacation Days” based on years of service. For my “Years of Service” formula I used 365.25 as my denominator. One day the Payroll dept contacts me with a discrepancy. One employee received 1 less day of bonus vacation time. When I expanded the result to 4 decimal places, the years of service came to 19.9971. When I changed my denominator to 365.20, the years of service came out to 20.0000. Here’s the formula:

    dateTimeVar d1 := {EMPLOYEE.ADJ_HIRE_DATE};

    dateTimeVar d2 := {?EndPayPeriod};

    NumberVar d3 := 0.0;

    Numbervar Difference := datediff(“d”, d1, d2 );

    d3 := (Difference/365.20000);

  2. Mark Kobulnick  •  Jul 12, 2010 @12:31 pm

    By the way, I changed the code to

    Numbervar Difference := datediff(“yyyy”, d1, d2)

    Much more efficient.

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



  • Donate

    If my work has helped you and you want to return the favor, you could purchase something for me from my Amazon Wish List or send me a donation via PayPal.

  • My Lifestream

  • License

    Unless otherwise noted, all source code and compiled files published on this website are released under the terms of the GNU Lesser General Public License.