Copyright © tutorialspoint.com

PHP Function date_default_timezone_get()

previous
Advertisements

Syntax

string date_default_timezone_get ( void );

Definition and Usage

Gets the default timezone used by all date/time functions in a script.

This functions returns the default timezone, using the following "guess" order:

Paramters

ParameterDescription
voidNA 

Return Value

Returns a string.

Example

Following is the usage of this function:

<?php
   echo "Old time zone is ". date_default_timezone_get();
   $timeZone = 'America/Costa_Rica';
   if( date_default_timezone_set( $timeZone) ){
      # Now get this time zone.
      echo "New time zone is ". date_default_timezone_get();
   }
?> 

This will produce following result:

Old time zone is America/Denver
New time zone is America/Costa_Rica
previous

Copyright © tutorialspoint.com