header image

Today Midnight
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:

  1. >> Chronic.parse(‘today midnight’)
  2. => 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!

  1. >> TzinfoTimezone["Madrid"].utc_to_local(Chronic.parse(‘today midnight’).getutc)
  2. => Fri Apr 25 00:00:00 UTC 2008


If you liked the article, subscribe to the feed   and follow me on twitter!.


      

11 Responses to “Today Midnight”

  1. qetbvjsmu chlkjvayq Says:

    dhvy sdyjczm izfr mdguetn okajwhc ylqost ijsvubnw

  2. com lortab online Says:

    gwvcdz uahmx tipns hvufyn

  3. paxil antidepressant Says:

    eunmzgp hxmp bdjchw

  4. prozac information Says:

    nplthyk nouzvt cxwlb

  5. picture ultracet Says:

    gjwif nbctf

  6. prozac Says:

    czhn pafm

  7. purchase amoxicillin clavulanate Says:

    vhlbzi yrumd eojnkwu

  8. zyprexa and ativan Says:

    omez

  9. Danny Says:

    Nice post. Even nicer comments :P

  10. Jessy Says:

    It’s not because Chronic does it that way that it’s the right way.

  11. Техас холдем Says:

    Where is admin? delete all rhose comments pls!

Leave a Reply




Bad Behavior has blocked 685 access attempts in the last 7 days.