At work today, I was stuck on an odd bug that had to deal with a datetime column. Or so I thought. Perhaps I just discovered the secret to time travel.
=> Sun Oct 10 00:00:00 UTC 2010
=> Fri Jan 20 00:00:00 UTC 2012
Apparently, there’s some weirdness with Ruby and the Time class where if you want the years 0-138AD, you can’t have them. That’s because they don’t exist. What you actually get when you try to turn the year 112AD into a Time object is space travel to the year 2012.
How to get around that? Use DateTime.
=> Tue, 20 Jan 0112 00:00:00 +0000