$30 off During Our Annual Pro Sale. View Details »

Time is Hard

Time is Hard

A look at why it's such a pain to deal with Date/Time in code, and some interesting corner cases. Given at IPRUG.

Chris Sinjakli

June 04, 2013
Tweet

More Decks by Chris Sinjakli

Other Decks in Programming

Transcript

  1. var offset = new Date().getTimezoneOffset(); offset = -offset; var time

    = moment("2010-10-20 14:30 +0000", "YYYY-MM-DD HH:mm Z"); var localTime = time.add("minutes", offset);
  2. var offset = new Date().getTimezoneOffset(); offset = -offset; var time

    = moment("2010-10-20 14:30 +0000", "YYYY-MM-DD HH:mm Z"); var localTime = time.add("minutes", offset); Changes with DST
  3. DST

  4. HTTP Logs [27/Oct/2013:01:30:00 +0100] "GET /some/page" [27/Oct/2013:01:59:00 +0100] "GET /another/page"

    [27/Oct/2013:01:30:00 +0000] "GET /some/page" [27/Oct/2013:00:30:00 +0000] "GET /some/page" [27/Oct/2013:00:59:00 +0000] "GET /another/page" [27/Oct/2013:01:30:00 +0000] "GET /some/page"