将 ISO 8601 转换为 unix 时间戳
2022-08-30 12:02:34
如何在PHP中将(ISO 8601)转换为(unixtimestamp)?2012-01-18T11:45:00+01:00
1326883500
如何在PHP中将(ISO 8601)转换为(unixtimestamp)?2012-01-18T11:45:00+01:00
1326883500
echo date("U",strtotime('2012-01-18T11:45:00+01:00'));
strtotime('2012-01-18T11:45:00+01:00');
// Output : 1326883500
date_format(date_timestamp_set(new DateTime(), 1326883500), 'c');
// Output : 2012-01-18T11:45:00+01:00
date_format(date_create('@'. 1326883500), 'c') . "\n";
// Output : 2012-01-18T10:45:00+00:00
date_format(date_timestamp_set(new DateTime(), 1326883500)->setTimezone(new DateTimeZone('America/New_York')), 'c');
// Output : 2012-01-18T05:45:00-05:00