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
 [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-2021 The PHP Group
All rights reserved.
Last updated: Wed Apr 21 21:01:24 2021 UTC