Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. var now = new Date();
  2. var nowSecs = now.valueOf();
  3. var nowUtc = new Date(now.getTime() + (now.getTimezoneOffset() * 60000));
  4. var nowUtcSecs = nowUtc.valueOf();
  5. var exp: any = Date.parse(expirationDate);
  6. var expSecs = exp.valueOf();
  7.  
  8. var diffSecs = (expSecs - nowUtcSecs) / 1000;
  9. var diffMins = diffSecs / 60;
  10.  
  11. console.log(expirationDate)
  12. VM2717:1 Fri, 27 Mar 2015 11:11:44 GMT
  13.  
  14. console.log(nowUtc)
  15. VM2796:1 Fri Mar 27 2015 11:32:42 GMT+0700 (SE Asia Standard Time)
  16.  
  17. console.log (diffMins)
  18. VM2943:1 399.0280166666667
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement