I have dates of events in another country which I need to save in database. Problem is that those dates have no timezone information included.
Timezone used in this location is CET (standard time) or CEST (summer time).
What is the easiest way to detect which one is in play?
I'm not quite sure what you're asking. I think what you need to find out is whether a particular date is in daylight savings or not. If so, you can use 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
If what you need is none of these, please clarify what you do need...
I would assume the date_default_timezone_get() function would give you the information you want, though I'm not completely sure it can differentiate between the standard/summer time.
date_default_timezone_get()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With