zerosum dirt(nap)

evolution through a series of accidents

zerosum dirt(nap)

Overlooking The Obvious

September 14, 2007 by nap · Comments

Sometimes we overlook the obvious. This had me scratching my head for a good 15 minutes yesterday. I’ll blame it on the plague (aka nasty cold) that I seem to have contracted.

>> format = "%A, %B %d %Y"
=> "%A, %B %d %Y"
>> monday = Time.now.beginning_of_week
=> Mon Sep 10 00:00:00 -0400 2007
>> monday.strftime(format)
=> "Monday, September 10 2007"
>> (monday+6.weeks).strftime(format)
=> "Monday, October 22 2007"
>> (monday+12.weeks).strftime(format)
=> "Sunday, December 02 2007"

Huh? Exactly 12 weeks from Monday is Sunday? WTF?

>> monday + 12.weeks
=> Sun Dec 02 23:00:00 -0500 2007
>> (monday + 12.weeks).dst?
=> false
>> monday.dst?
=> true

Three letters: <a href="http://en.wikipedia.org/wiki/Daylight_savings_time">D S T</a>. Heh.
blog comments powered by Disqus