pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PHP pastebin - collaborative debugging tool View Help


Posted by Nick Beam on Mon 26 Nov 07:52
report abuse | download | new post

  1. // replacement for strtotime(), doesn't work on 1&1
  2. function parse_datetime($datetime) {
  3.         // 2007-10-18T00:56:00.001-04:00
  4.         // int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]] )
  5.         $halves = explode("T", $datetime);
  6.         $date = explode("-", $halves[0]);
  7.         $time = array();
  8.         preg_match("/([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])\.([0-9]{3})\-([0-5][0-9])\:([0-5][0-9])/", $halves[1], $time);
  9.         return mktime($time[1], $time[2], $time[3], $date[1], $date[2], $date[0]);
  10. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post