Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

date_default_timezone_set

(PHP 5 >= 5.1.0RC1)

date_default_timezone_set --  Sets the default timezone used by all date/time functions in a script

Описание

bool date_default_timezone_set ( string timezone_identifier )

date_default_timezone_set() sets the default timezone used by all date/time functions.

Замечание: Since PHP 5.1.0 (when the date/time functions were rewritten), every call to a date/time function will generate a E_NOTICE if the timezone isn't valid, and/or a E_STRICT message if using the system settings or the TZ environment variable.

Instead of using this function to set the default timezone in your script, you can also use the INI setting date.timezone to set the default timezone.

Список параметров

timezone_identifier

The timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available in the Прил. H.

Возвращаемые значения

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

Список изменений

ВерсияОписание
5.1.2 The function started to validate the timezone_identifier parameter.

Смотрите также

date_default_timezone_get()



date_format> <date_default_timezone_get
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
date_default_timezone_set
php_manual at lk2 dot de
12-Aug-2007 01:37
@davidn at datalinktech dot com dot au

set_default_timezone() has no effect at all on how apache logs are timestamped (at least for me)

It is however true, that all dates and times that php formats that are _not_ timestamps will be in that timezone.

Timestamps are always GMT
legolas558 d0t users dot sf dot net
10-Jun-2007 06:34
http://drakecms.sf.net/index.php?option=content&id=32&Itemid=10

A short tutorial which explains how to consistently implement timezones with PHP4 while remaining forward compatible with PHP5.
PeerGoal.com
12-Feb-2007 04:21
The problem:

date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PST/-8.0/no DST' instead

Of course this is a problem that recently surfaced since PHP5. Quick fix is to set your time zone, add this line to your php code:

date_default_timezone_set("America/Los_Angeles");
davidn at datalinktech dot com dot au
21-Dec-2006 05:27
Note that there may be some unexpected side-effects that result from using either set_default_timezone() or the putenv("TZ=...") workalike for earlier PHP versions.  ANY date formatted and output either by PHP or its apache host process will be unconditionally expressed in that timezone.

This does indeed include the web server's logs and other output files and reports which by default usually do not include any indication of timezone. This has a further side-effect on log processing and analysis, obviously.
Chris
22-Nov-2006 10:14
See the user contributed notes for the putenv function for a workaround for previous versions of PHP.

date_format> <date_default_timezone_get
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571