April 24th, 2008
I have been always uncertain about the exact expression denoting today midnight (or any day midnight, for that matter). Is 00:00 on e.g. April 24th the midnight between 23rd and 24th or 24th and 25th? If I want something to happen at today midnight, is that today’s date at 00:00? (for the impatient: no, it isn’t :-)).
Chronic to the rescue! (If you don’t know chronic, be sure to check it out - it’s a great natural language date/time parser). All I had to do is:
- >> Chronic.parse(‘today midnight’)
- => Fri Apr 25 00:00:00 +0200 2008
so actually it turns out it’s tomorrow’s date at 00:00.
I couldn’t find time zone support though (I am not saying it’s not there, just that I couldn’t find it by looking at the API) - so what if I want to meet someone in Madrid today midnight? Why, I install the tzinfo gem and ask Ruby!
- >> TzinfoTimezone["Madrid"].utc_to_local(Chronic.parse(‘today midnight’).getutc)
- => Fri Apr 25 00:00:00 UTC 2008

September 16th, 2008 at 10:39 am
dhvy sdyjczm izfr mdguetn okajwhc ylqost ijsvubnw
September 21st, 2008 at 8:27 am
gwvcdz uahmx tipns hvufyn
September 21st, 2008 at 4:09 pm
eunmzgp hxmp bdjchw
September 22nd, 2008 at 6:11 am
nplthyk nouzvt cxwlb
September 22nd, 2008 at 7:41 pm
gjwif nbctf
September 25th, 2008 at 11:05 pm
czhn pafm
October 1st, 2008 at 6:39 am
vhlbzi yrumd eojnkwu
October 14th, 2008 at 1:24 am
omez
January 21st, 2009 at 11:36 am
Nice post. Even nicer comments
March 6th, 2009 at 9:08 am
It’s not because Chronic does it that way that it’s the right way.