0

PHP プログラムの抜粋:

$currentDate = date("Y-m-d H:i");
echo $currentDate."<br/>";
echo "It is now " . date('l dS \o\f F Y h:i:s A', $currentDate)."<br />";
echo "It is now " .$currentDate."<br /><br />";

画面出力抜粋

2013-02-08 01:15
It is now Thursday 01st of January 1970 10:33:33 AM
It is now 2013-02-08 01:15
4

4 に答える 4

2

の 2 番目のパラメーターはdate()、フォーマットされた文字列ではなく、タイムスタンプである必要があります。

于 2013-02-07T14:31:04.350 に答える
1

Date requires a unix timestamp (integer) as the 2nd argument. You fed it a string.

于 2013-02-07T14:32:19.503 に答える
0

dateフォーマットされた文字列ではなく、タイムスタンプが必要です。使用する

$currentDate = time(); // returns a timestamp

参考: http: //php.net/date

于 2013-02-07T14:31:28.990 に答える
0

date() assumes that the second parameter is a unix timestamp. 1.1.1970 is the timestamp 0. It tries to interpret your string as a number.

See the date manual.

于 2013-02-07T14:32:44.223 に答える