If you want the dutch time on your pages and you are hosted on a server in the USA you can easily change it this way:
<?php
setlocale(LC_TIME, 'nl_NL');
$tgl = gmstrftime("%d %B %Y - %H:%M uur",time()+3600);
?>
Then use $tgl to display the right time.
Note the +3600 is a day light savings time correction.
The result: 22 maart 2005 - 16:39 uur
First I used the normal date function and this was the previous result: March 22, 2005 - 04:28 AM
I needed it for a dutch guestbook.
I'm new to PHP and it took me a while to find it out and maybe it's of no use for experienced PHP programmers but I thought people can always ignore my post :)
gmstrftime
(PHP 4, PHP 5)
gmstrftime — ロケールの設定に基づいて GMT/UTC 時刻/日付をフォーマットする
説明
string gmstrftime
( string $format
[, int $timestamp = time()
] )
グリニッジ標準時を返すこと以外は、 strftime() と同じ動作をします。例えば、東部標準時 (GMT -0500) で実行した場合、以下の最初の行は "Dec 31 1998 20:00:00" を出力し、二行目は "Jan 01 1999 01:00:00" を出力します。
パラメータ
- format
-
strftime() の説明を参照ください。
- timestamp
-
オプションのパラメータ timestamp は、 integer 型の Unix タイムスタンプです。 timestamp が指定されなかった場合のデフォルト値は、 現在の時刻です。言い換えると、デフォルトは time() の返り値となります。
返り値
指定した timestamp または timestamp が指定されていない場合に現在のローカル時間を用いて、 指定したフォーマット文字列に基づき文字列をフォーマットして返します。 月および曜日の名前、およびその他の言語依存の文字列は、 setlocale() で設定された現在のロケールを尊重して表示されます。
例
例1 gmstrftime() の例
<?php
setlocale(LC_TIME, 'en_US');
echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
?>
gmstrftime
pvdster at hotmail dot com
23-Mar-2005 12:50
23-Mar-2005 12:50
peter dot albertsson at spray dot se
06-Feb-2005 12:27
06-Feb-2005 12:27
gmstrftime() should not be used to generate a RFC 850 date for use in HTTP headers, since its output is affected by setlocale().
Use gmdate instead:
gmdate('D, d M Y H:i:s') . ' GMT';
yellow dot snow at huskies dot com
11-Oct-2004 01:15
11-Oct-2004 01:15
HTTP 1.1 (RFC 2068) requires an RFC 1123 date with a four digit year, so the correct format to use for a Last-modified header would look something like this:
<?php
header("Last-modified: " .
gmstrftime("%a, %d %b %Y %T %Z",getlastmod()));
?>
neo at gothic-chat d0t de
25-Jun-2004 03:27
25-Jun-2004 03:27
To get a RFC 850 date (used in HTTP) of the current time:
gmstrftime ("%A %d-%b-%y %T %Z", time ());
This will get for example:
Friday 25-Jun-04 03:30:23 GMT
Please note that times in HTTP-headers _must_ be GMT, so use gmstrftime() instead of strftime().
