php - 具有欧洲日期格式的 Strtotime

标签 php string time

我正在尝试使用 strtotime 转换以下日期:

07/09/2009 17:01:27

这是 9 月 7 日的欧洲/伦敦时区格式

该功能正在反转月份和日期,有什么解决方法吗?
谢谢

最佳答案

更改 /- , 好像 PHP 得到 /作为美国格式,和 -作为欧洲人。你可以在这里看到:

$date = "06/10/2011 14:28"; // 6 october 2011 2:28 pm
$otherDate = "06-10-2011 14:28"; // 6 october 2011 2:28 pm

echo $stamp = strtotime($date) . "<br />"; // outputs 1307708880
echo $otherStamp = strtotime($otherDate) . "<br />"; // outputs 1317904080

echo date("d-m", $stamp); // outputs 10-06
echo date("d-m", $otherStamp); // outputs 06-10

http://www.php.net/manual/es/function.strtotime.php#106043

关于php - 具有欧洲日期格式的 Strtotime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1389830/

相关文章:

javascript - Symfony 4/javascript - 关系上的 UniqueEntity 约束

javascript - 使用 Dropzone 'ProcessQueue' 事件发送参数

R - 字符串处理的变异 - 没有得到我希望的行为

ruby - 如何在 ruby​​ 中使用正则表达式计算子字符串?

c++ - 如何将包含时间的字符串变量转换为 c++ 中的 time_t 类型?

time - 如何在 Go 中检测时间?

php - 在更新时我的 where 条件不起作用

php - fatal error : session_start() after upgrading to Codeigniter 3

python - 从文件中删除字符串和字符串之前的所有行

algorithm - 如何将递归定义的输入大小函数转换为问题输入大小的直接函数?