|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-07-19 16:03 UTC] odoucet@php.net
Description: ------------ Creating a new DateTime object with a unix timestamp failed with error Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1279547855) at position 8 (5): Unexpected character' If this is expected behaviour, this should be written in documentation and DateTime::setTimestamp() should be fixed: http://www.php.net/manual/en/datetime.settimestamp.php#Notes "Passing a Unix timestamp to DateTime::__construct() is an alternative when using PHP 5.2." Test script: --------------- <?php var_dump(new DateTime(time())); Expected result: ---------------- no fatal error :) Actual result: -------------- Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1279547855) at position 8 (5): Unexpected character' PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 11:00:01 2025 UTC |
<?php var_dump(new DateTime('@' . time()));