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