Opened 4 years ago
Last modified 3 years ago
#24730 new enhancement
Introduce a timezone-retrieval method
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Date/Time | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When working with times and dates, it's useful to have the timezone used in WordPress, however there's no unified way to get it.
get_option('gmt_offset') is filtered and the current offset is translated from the timezone string, but there's no reverse which is needed when working with relative times and dates.
There are two ways we could handle this:
- Filter timezone_string and work out the correct string - This will likely break the admin interface for it.
- Introduce a new function to get the timezone from timezone_string, and fall back to gmt_offset if needed.
Patch has implementation of the second option (also using DateTimeZone), can be adapted as necessary for the first.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Add a wp_get_timezone() function