我在另一个国家/地区的活动日期需要保存在数据库中.问题是这些日期没有包含时区信息.
此位置使用的时区是CET(标准时间)或CEST(夏令时).
检测哪一个在场的最简单方法是什么?
我不太确定你在问什么。我认为您需要查明特定日期是否处于夏令时。如果是这样,您可以使用date('I').
$dst_now = date('I'); // whether our current timezone is currently in DST
$dst_then = date('I', strtotime($date)); // whether that date is in DST for our current timezone
$date_obj = new DateTime($date, new DateTimeZone('Europe/Paris'));
$dst_thereandthen = $date_obj->format('I');
// whether that date is in DST for that timezone
Run Code Online (Sandbox Code Playgroud)
如果您需要的不是这些,请澄清您需要什么......