You missed the @ before the number ;) On Sat, Dec 24, 2011 at 4:00 PM, Pierre Joye <pierre....@gmail.com> wrote: > On Sat, Dec 24, 2011 at 12:55 PM, Derick Rethans <der...@php.net> wrote: > >> new DateTime("@{$_SERVER['REQUEST_TIME']}"); f.e. > > Not following you here, how does it work better in 5.3.x? It is a > float but datetime fails just like before. > > php536nts>php -n -r "var_dump($_SERVER['REQUEST_TIME']);new > Datetime($_SERVER['REQUEST_TIME']);" > int(1324738540) > > Fatal error: Uncaught exception 'Exception' with message > 'DateTime::__construct(): Failed to parse time string (1324738540) at > position 8 (4): Unexpected character' in Command line code:1 > Stack trace: > #0 Command line code(1): DateTime->__construct('1324738540') > #1 {main} > thrown in Command line code on line 1 > > > 5.3.9rc4>php -n -r "var_dump($_SERVER['REQUEST_TIME']);new > Datetime($_SERVER['REQUEST_TIME']);" > int(1324738655) > > Fatal error: Uncaught exception 'Exception' with message > 'DateTime::__construct(): Failed to parse time string (1324738655) at > position 8 (5): Unexpected character' in Command line code:1 > Stack trace: > #0 Command line code(1): DateTime->__construct('1324738655') > #1 {main} > thrown in Command line code on line 1 > > and with 5.4.0RC4: > > 5.4.0rc4-nts>php -n -r "var_dump($_SERVER['REQUEST_TIME']);new > Datetime($_SERVER['REQUEST_TIME']);" > float(1324738763.2993) > > Fatal error: Uncaught exception 'Exception' with message > 'DateTime::__construct(): Failed to parse time string > (1324738763.2993) at position 8 (6): Unexpected character' in Command > line code:1 > Stack trace: > #0 Command line code(1): DateTime->__construct('1324738763.2993') > #1 {main} > thrown in Command line code on line 1 > > Cheers, > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php