Re: [PHP] A little confused

2013-04-23 Thread Marco Behnke
Am 23.04.13 12:07, schrieb Chris Knipe: > Hi All, > > $_SESSION['ExpiryDate'] = "2013-04-23"; > echo date_format($_SESSION['ExpiryDate'], "D, \t\h\e jS \o\f M Y"); > > Required Result: Mon, the 23rd of Apr 2013 > > I get however: PHP Warning: date_format() expects parameter 1 to be > DateTime, in

Re: [PHP] A little confused

2013-04-23 Thread Chris Knipe
Thanks for the replies guys - figured it out! Using date() directly with strtotime() and the appropriate formating works :) date("D, \\t\h\e jS \o\\f M Y", strtotime($_SESSION['ExpiryTime'])) On Tue, Apr 23, 2013 at 12:16 PM, shiplu wrote: > > On Tue, Apr 23, 2013 at 4:07 PM, Chris Knipe w

Re: [PHP] A little confused

2013-04-23 Thread shiplu
On Tue, Apr 23, 2013 at 4:07 PM, Chris Knipe wrote: > echo date_format($_SESSION['ExpiryDate'], "D, \t\h\e jS \o\f M Y"); > Why not construct DateTime object echo date_format(new DateTime($_SESSION['ExpiryDate']), "D, \t\h\e jS \o\f M Y"); Or $dt = new DateTime($_SESSION['ExpiryDate']); echo

Re: [PHP] A little confused

2013-04-23 Thread Stuart Dallas
On 23 Apr 2013, at 11:13, Chris Knipe wrote: > Yes, > > strtotime() does convert the $_SESSION value to a unix epoc, as expected. > However, date_format still complains that the argument is a Integer value, > instead of a DateTime. Sorry, I didn't read your email properly and didn't realise

Re: [PHP] A little confused

2013-04-23 Thread Chris Knipe
Yes, strtotime() does convert the $_SESSION value to a unix epoc, as expected. However, date_format still complains that the argument is a Integer value, instead of a DateTime. On Tue, Apr 23, 2013 at 12:09 PM, Stuart Dallas wrote: > On 23 Apr 2013, at 11:07, "Chris Knipe" wrote: > > > $_SE

Re: [PHP] A little confused

2013-04-23 Thread Stuart Dallas
On 23 Apr 2013, at 11:07, "Chris Knipe" wrote: > $_SESSION['ExpiryDate'] = "2013-04-23"; > echo date_format($_SESSION['ExpiryDate'], "D, \t\h\e jS \o\f M Y"); > > Required Result: Mon, the 23rd of Apr 2013 > > I get however: PHP Warning: date_format() expects parameter 1 to be > DateTime, int