Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var now = new Date();
- var nowSecs = now.valueOf();
- var nowUtc = new Date(now.getTime() + (now.getTimezoneOffset() * 60000));
- var nowUtcSecs = nowUtc.valueOf();
- var exp: any = Date.parse(expirationDate);
- var expSecs = exp.valueOf();
- var diffSecs = (expSecs - nowUtcSecs) / 1000;
- var diffMins = diffSecs / 60;
- console.log(expirationDate)
- VM2717:1 Fri, 27 Mar 2015 11:11:44 GMT
- console.log(nowUtc)
- VM2796:1 Fri Mar 27 2015 11:32:42 GMT+0700 (SE Asia Standard Time)
- console.log (diffMins)
- VM2943:1 399.0280166666667
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement