(PHP 5 >= 5.1.0, PHP 7)
date_default_timezone_get — ȡ��һ���ű�����������ʱ�亯����ʹ�õ�Ĭ��ʱ��
����������Ĭ��ʱ����ʹ������"�ٶ�"��˳��
�� date_default_timezone_set() �����趨��ʱ��������趨�˵Ļ���
������ PHP 5.4.0 ֮ǰ�� TZ ��������������ǿգ�
date.timezone ����ѡ�����趨�˵Ļ���
������ PHP 5.4.0 ֮ǰ�� ��ѯ����ϵͳ���� (�������ϵͳ֧�ֲ�����)�� This uses an algorithm that has to guess the timezone. This is by no means going to work correctly for every situation. A warning is shown when this stage is reached. Do not rely on it to be guessed correctly, and set date.timezone to the correct timezone instead.
�������ѡ���ɹ���date_default_timezone_get() ���� UTC ��Ĭ��ʱ����
����һ�� string��
�汾 | ˵�� |
---|---|
5.4.0 | ����ʹ�� TZ ���Ʋ�ʱ���� |
5.4.0 | ���ٸ��ݲ���ϵͳ����Ϣ���Ʋ�ʱ������Ϊ���Dz��ɿ��ġ� |
Example #1 ��ȡĬ��ʱ��
<?php
date_default_timezone_set('Europe/London');
if (date_default_timezone_get()) {
echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />';
}
if (ini_get('date.timezone')) {
echo 'date.timezone: ' . ini_get('date.timezone');
}
?>
�������̵���������ڣ�
date_default_timezone_set: Europe/London date.timezone: Europe/London
Example #2 ��ȡһ��ʱ���ļ�д
<?php
date_default_timezone_set('America/Los_Angeles');
echo date_default_timezone_get() . ' => ' . date('e') . ' => ' . date('T');
?>
�������̻������
America/Los_Angeles => America/Los_Angeles => PST