Is it possible in PHP to get the timezone offset for a given location? E.g. when given the location "Sydney/Australia" to get the timezone offset as "+1100". Bonus would be for this function the keep daylight savings in mind (i.e. it's aware of daylight savings and adjusts the offset according).
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
To display a local date/time you can use the following, where 'Europe/Berlin' would be replaced with the user's timezone.
Not sure why you need "+1100" (rather than a decimal representation) but you can use this:
Replace
null
with'2010-10-01'
and you'll get1000
You can use the DateTimeZone class.