Tuesday, September 26, 2017

Calculate Daylight Savings Time Date

The web based apps I write often have informative messages for the users, and one request was a reminder to change the clocks for Daylight Savings Time. Since it's not the same date each year, but is always the Second Sunday of March and the First Sunday of November, I needed to be able to get a date for those days. It's fairly easy in PHP, as you can see below.



$year = date('Y');
$spring = date('m-d-Y 02:00:00 A', 
strtotime('Second Sunday Of March '.$year)); $fall = date('m-d-Y 02:00:00 A',
strtotime('First Sunday Of November '.$year)); echo 'Spring: ' . $spring; echo 'Fall: ' . $fall;
Here is the quiz of the day:

How would you accomplish this on the Arduino?

Reference:

Arduino Time Libraries

Arduino DST Solution

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...