Organizational Research By

Surprising Reserch Topic

check if daylight saving time is in effect and if it is for how many hours


check if daylight saving time is in effect and if it is for how many hours  using -''

Using JavaScript, how can I check if Daylight Saving Time (DST) is in use at the moment, and if it is for how many hours?

This is a bit of my js code for which this is needed:

var secDiff=Math.abs(Math.round((utc_date-this.premiere_date)/1000));
this.years=this.calculateUnit(secDiff,(86400*365));
this.days=this.calculateUnit(secDiff-(this.years*(86400*365)),86400);
this.hours=this.calculateUnit((secDiff-(this.years*(86400*365))-(this.days*86400)),3600);
this.minutes=this.calculateUnit((secDiff-(this.years*(86400*365))-(this.days*86400)-(this.hours*3600)),60);
this.seconds=this.calculateUnit((secDiff-(this.years*(86400*365))-(this.days*86400)-(this.hours*3600)-(this.minutes*60)),1);


I want to get the datetime in ago, but if the DST is in use then the dates are wrong for 1 hour, and that's my problem. I don't know how to check if the DST is in use or not.

How to get when daylight saving starts and ends? <--- I think that this could help me. Just can't find it.
    
asked Oct 13, 2015 by atulpariharmca
0 votes
8 views



Related Hot Questions



Government Jobs Opening


...