Php Parse Iso 8601 Date
This is all well and good, except the%o modifier will give you a different year if the ISO-8601 week 'belongs' to a different year. Samsung Clp 315 Reset Firmware Xerox more. Case in point: we have payments logged for 2013-12-31 which, in normal/not-crazy-person date, should be 2012-12-31.
Procedural style: echo date_format(date_create('17 Oct 2008'), 'c'); // Output: 2008-10-17T00:00:00+02:00 Object oriented style: $formatteddate = new DateTime('17 Oct 2008'); echo $datetime->format('c'); // Output: 2008-10-17T00:00:00+02:00 Hybrid 1: echo date_format(new DateTime('17 Oct 2008'), 'c'); // Output: 2008-10-17T00:00:00+02:00 Hybrid 2: echo date_create('17 Oct 2008')->format('c'); // Output: 2008-10-17T00:00:00+02:00 Notes: 1) You could also use 'Y-m-d TH:i:sP' as an alternative to 'c' for your format. 2) The default time zone of your input is the time zone of your server. Hp Officejet 6200 Windows Xp Driver. If you want the input to be for a different time zone, you need to set your time zone explicitly.
This will also impact your output, however: echo date_format(date_create('17 Oct 2008 +0800'), 'c'); // Output: 2008-10-17T00:00:00+08:00 3) If you want the output to be for a time zone different from that of your input, you can set your time zone explicitly: echo date_format(date_create('17 Oct 2008')->setTimezone(new DateTimeZone('America/New_York')), 'c'); // Output: 2008-10-16T18:00:00-04:00.