How to Get Default Timezone in PHP?

by Dinesh 2014-09-09 14:17:26

The function returns FALSE if the timezone_identifier isn't valid, or TRUE otherwise.
 

<?php
date_default_timezone_set('India/Coimbatore');

$script_tz = date_default_timezone_get();

if (strcmp($script_tz, ini_get('date.timezone'))){
    echo 'Script timezone differs from ini-set timezone.';
} else {
    echo 'Script timezone and ini-set timezone match.';
}
?>

Tagged in:

1321
like
0
dislike
0
mail
flag

You must LOGIN to add comments