date_timezone_get
date
Date/Time Functions
PHP Manual

# date_timezone_set

(PHP 5 >= 5.2.0)

date_timezone_set — Sets the time zone for the DateTime object

### Description

void date_timezone_set ( DateTime `$object` , DateTimeZone `$timezone` )
void DateTime::setTimezone ( DateTimeZone `$timezone` )

### Parameters

`object`

  Procedural style only: A DateTime object returned by date_create()

`timezone`

  Desired time zone.

### Return Values

Returns `NULL` on success or `FALSE` on failure.

### Examples

Example #1 Setting and getting DateTimeZone objects

`<?php
date_default_timezone_set('Europe/London');
$datetime = new DateTime('2008-08-03 12:35:23');
echo $datetime->getTimezone()->getName() . "\n";
$datetime = new DateTime('2008-08-03 12:35:23');
$la_time = new DateTimeZone('America/Los_Angeles');
$datetime->setTimezone($la_time);
echo $datetime->getTimezone()->getName();
?>`

The above example will output:

    Europe/London
    America/Los_Angeles

### See Also

- date_timezone_get()
- timezone_open()

date_timezone_get
date
Date/Time Functions
PHP Manual