Timestamps and strftime
| From: | John Comerford | Date: | Thu, 04 Jun 2009 06:09:34 +0000 |
| Subject: | Timestamps and strftime | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-293593@lists.php.net to get a copy of this message | ||
Hi,
I am having a problem trying to use a date that I take from a MySQL database. The field is defined as a timestamp in the database. I extract it using PDO and I am trying to use the value with strftime as follows:
foreach ($stmt->fetchall(PDO::FETCH_ASSOC) as $row) {
echo strftime("%j",$row['UpdateDate']);
}
but it returns the following error:
PHP Notice: A non well formed numeric value encountered...
I understand that this is because strftime is expecting a numeric value and that ,$row['UpdateDate'] is a character but I am not sure how to resolve the issue. Any help would be apprecaited.
TIA,
JC