简体   繁体   English

将欧洲时间格式转换为时间戳

[英]Convert european time format to timestamp

What is the most efficient way to convert a given European formatted date (DD/MM/YY) to the correct timestamp? 将给定的欧洲格式日期(DD / MM / YY)转换为正确的时间戳的最有效方法是什么?

Example: 10/11/12 should output 1352505600 as the 10th November 2012, and not the October 11th 2012 示例:2012年10月11日应在2012年11月10日而不是2012年10月11日输出1352505600

DateTime::createFromFormat()

$date = DateTime::createFromFormat('d/m/y', $eu_date);
echo $date->format("U");

使用date函数的第二个可选变量向其提供unix时间戳

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM