Doc->Bug #67402 [Opn->Nab]: DateTime cannot be converted to string
| From: | aharvey@php.net | Date: | Mon, 09 Jun 2014 16:28:48 +0000 |
| Subject: | Doc->Bug #67402 [Opn->Nab]: DateTime cannot be converted to string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186117@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67402&edit=1
ID: 67402
Updated by: aharvey@php.net
Reported by: larene at pictordesign dot com
-Summary: PHP 5.2.17
+Summary: DateTime cannot be converted to string
-Status: Open
+Status: Not a bug
-Type: Documentation Problem
+Type: Bug
-Package: Performance problem
+Package: Date/time related
Operating System: Red Hat Lynix
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Presumably somewhere after this line, you are using $offer_end in a context where PHP will attempt
to convert it to a string (such as an echo statement). DateTime objects (intentionally) do not
implement a __toString() method, and cannot be converted to string.
Previous Comments:
------------------------------------------------------------------------
[2014-06-09 16:25:32] larene at pictordesign dot com
Description:
------------
---
From manual page: http://www.php.net/function.date-create
---
Putting this in my code:
$offer_end = new DateTime('06/06/2014');
Results in this error:
[Mon Jun 09 11:16:31 2014] [error] [client 70.34.10.173] PHP Catchable fatal error: Object of class
DateTime could not be converted to string in
/home/test455/www/test455.fsreloading.com/fsadmin/emailSpecialOffers.php on line 147, referer: https://test.fsreloading.com/fsadmin/emailSpecialOffers.php
Test script:
---------------
$offer_end = new DateTime('06/06/2014');
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67402&edit=1