strtotime()
如果你能提供一个它能够理解并可以转换的日期格式,那么在PHP中效果很好,但是例如你给它一个英国日期,它就不能给出正确的unix时间戳。接受格式的PHP strtotime()函数?
是否有任何PHP函数,官方或非官方的,可以接受格式变量,告诉日期和时间通过哪种格式的函数?
我来这样做的最接近的是date_parse_from_format()
和您正在寻找strptime混合mktime()
// Example usage of the function I'm after
//Like the date() function but in reverse
$timestamp = strtotimeformat("03/05/2011 16:33:00", "d/m/Y H:i:s");
我正在寻找返回一个unix时间戳而不是另一种字符串格式的日期。 – Brady 2011-05-03 15:45:59
'getTimestamp'返回一个unix时间戳... – meze 2011-05-03 15:48:34
但是' - > getTimestamp()'确实返回一个unix时间戳... – Andrew 2011-05-03 15:50:10