php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77672 Add getOffset method to DateTimeInterface
Submitted: 2019-02-26 20:15 UTC Modified: 2019-02-27 00:45 UTC
From: sites+php at dan dot cx Assigned:
Status: Closed Package: Date/time related
PHP Version: 7.3.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
18 + 35 = ?
Subscribe to this entry?

 
 [2019-02-26 20:15 UTC] sites+php at dan dot cx
Description:
------------
To get the timezone offset of a DateTime or DateTimeImmutable instance, you need to do this:

$date->getTimezone()->getOffset($date)

Please consider adding a `getOffset` method to `DateTimeInterface`, so this can be simplified to:

$date->getOffset()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-26 23:17 UTC] a at b dot c dot de
Um... it's already there?
 [2019-02-27 00:39 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2019-02-27 00:45 UTC] sites+php at dan dot cx
-Status: Feedback +Status: Closed
 [2019-02-27 00:45 UTC] sites+php at dan dot cx
You're right. My mistake... Not sure how I missed that.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 22:01:29 2024 UTC