Tat*_*nen 20
嗯,最简单的可能是:
date_default_timezone_set('America/Los_Angeles');
echo date('Y-m-d');
Run Code Online (Sandbox Code Playgroud)
Cha*_*les 11
让我们尝试使用PHP的现代日期处理的解决方案.此示例需要PHP 5.2或更高版本.
// Right now it's about four minutes before 1 PM, PST.
$pst = new DateTimeZone('America/Los_Angeles');
$three_hours_ago = new DateTime('-3 hours', $pst); // first argument uses strtotime parsing
echo $three_hours_ago->format('Y-m-d H:i:s'); // "2010-06-15 09:56:36"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22245 次 |
| 最近记录: |