php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #40171 There should be a way to create DateTime object from UTC timestamp.
Submitted: 2007-01-19 16:27 UTC Modified: 2007-01-19 18:25 UTC
Votes:39
Avg. Score:3.4 ± 1.1
Reproduced:21 of 23 (91.3%)
Same Version:11 (52.4%)
Same OS:5 (23.8%)
From: rkumar at msgme dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.2.0 OS: Linux
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-01-19 16:27 UTC] rkumar at msgme dot com
Description:
------------
The constructor for DateTime object currently takes a string 
as a parameter. In most of the scenarios that I have encountered I need to create a DateTime object from UTC timestamp. Can the constructor  be changed to accept string or integer? 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-19 18:25 UTC] derick@php.net
That would be too confusing, as PHP auto casts and "20070119" is something quite different from the unix timestamp 20070119. What you can do is pass this to the ctor: "@20070119" - the @ makes it interpret as a Unix timestamp.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 00:02:04 2014 UTC