<?php
// A demonstration of the new DateTime class and the
// fact that it fixes dates before 1970 and after 2038.
?>
<h2>PHP 2038 date bug demo (php version <?=phpversion()?>)</h1>
<div style='float:left;margin-right:3em;'>
<h3>OLD Buggy date()</h3>
<?
for ( $i = 1900; $i < 2050; $i++) {
$datep = "$i-01-01";
print " Trying: $datep ... ";
print date("F j, Y", strtotime($datep));
print "<BR>";
}
?></div>
<div style='float:left;'>
<h3>NEW DateTime Class (v 5.2+)</h3><?
for ( $i = 1900; $i < 2050; $i++) {
$datep = "$i-01-01";
$date = new DateTime($datep);
print " Trying: $datep ... ";
print $date->format('F j, Y');
print "<BR>";
}
?></div>
日付・時刻
- 導入
- インストール/設定
- 定義済み定数
- サポートされるタイムゾーンのリスト
- 日付・時刻 関数
- checkdate — グレグリオ歴の日付/時刻の妥当性を確認します
- date_add — 年月日時分秒の値を DateTime オブジェクトに加える
- date_create — 新しい DateTime オブジェクトを返す
- date_date_set — 日付を設定する
- date_default_timezone_get — スクリプト中の日付/時刻関数で使用されるデフォルトタイムゾーンを取得する
- date_default_timezone_set — スクリプト中の日付/時刻関数で使用されるデフォルトタイムゾーンを設定する
- date_format — 指定した書式でフォーマットした日付を返す
- date_isodate_set — ISO 日付を設定する
- date_modify — タイムスタンプを変更する
- date_offset_get — 夏時間のオフセットを返す
- date_parse — 指定した日付に関する詳細な情報を連想配列で返す
- date_sub — 年月日時分秒の値を DateTime オブジェクトから引く
- date_sun_info — 日の出/日の入り時刻と薄明かり (twilight) の開始/終了時刻の情報を含む配列を返す
- date_sunrise — 指定した日付と場所についての日の出時刻を返す
- date_sunset — 指定した日付と場所についての日の入り時刻を返す
- date_time_set — 時刻を設定する
- date_timezone_get — 指定した DateTime に関連するタイムゾーンを返す
- date_timezone_set — DateTime オブジェクトのタイムゾーンを設定する
- date — ローカルの日付/時刻を書式化する
- getdate — 日付/時刻情報を取得する
- gettimeofday — 現在の時間を得る
- gmdate — GMT/UTC の日付/時刻を書式化する
- gmmktime — GMT 日付から Unix タイムスタンプを取得する
- gmstrftime — ロケールの設定に基づいて GMT/UTC 時刻/日付をフォーマットする
- idate — ローカルな時刻/日付を整数として整形する
- localtime — ローカルタイムを得る
- microtime — 現在の Unix タイムスタンプをマイクロ秒まで返す
- mktime — 日付を Unix のタイムスタンプとして取得する
- strftime — ロケールの設定に基づいてローカルな日付・時間をフォーマットする
- strptime — strftime が生成した日付/時刻をパースする
- strtotime — 英文形式の日付を Unix タイムスタンプに変換する
- time — 現在の Unix タイムスタンプを返す
- timezone_abbreviations_list — 夏時間、オフセットおよびタイムゾーン名を含む連想配列を返す
- timezone_identifiers_list — すべてのタイムゾーン識別子を含む配列を返す
- timezone_name_from_abbr — 略称からタイムゾーン名を返す
- timezone_name_get — タイムゾーンの名前を返す
- timezone_offset_get — GMT からのタイムゾーンのオフセットを返す
- timezone_open — 新しい DateTimeZone オブジェクトを返す
- timezone_transitions_get — タイムゾーンの変遷を返す
Date/Time
JonathanCross.com
26-Jul-2008 04:13
26-Jul-2008 04:13
