Re: A little confused
| From: | Marco Behnke | Date: | Tue, 23 Apr 2013 19:34:15 +0000 |
| Subject: | Re: A little confused | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320973@lists.php.net to get a copy of this message | ||
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, integer given in
>
> I've had a look at the date/time function list, but I cannot seem to find
> any way to convert $_SESSION['ExpiryDate'] to an DateTime??
Take a look at this:
http://de3.php.net/manual/en/datetime.createfromformat.php
Or try this
http://de3.php.net/manual/en/function.strtotime.php
$_SESSION['ExpiryDate'] = "2013-04-23";
$int_timestamp = strtotime($_SESSION['ExpiryDate']);
echo date('D, \t\h\e jS \o\f M Y', $int_timestamp );
Use SINGLE QUOTES!
>
> --
> Chris.
>
>
>
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: marco@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc