Dave's Brain

Browse - Programming Tips - How can I get the name of the local time zone?

Date: 2014nov25
Language: php

Q.  How can I get the name of the local time zone?

A.  "T" from the date() function will do it.
You do nor have to give date() a time since it doesn't matter for the timezone.

<?php // This is what you usually want - eg "EST" function getTimeZoneAbbrev() { return date('T'); } function getTimeZoneName() { return date('e'); } print getTimeZoneName(); ?>

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.