2
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

JavaScriptでISO8601→UNIXタイムスタンプ

こんなかんじで

new Date(ISO_TIME).getTime() / 1000

確認環境

>node -v
v7.4.0

Node.js のサンプル

ISOtoUNIX.js
'use strict'

let iso = '2017-06-08T02:09:54Z';
console.log('isotime: ' + iso);

let ts =  new Date(iso).getTime() / 1000;
console.log('unixts: ' + ts);

実行結果

>node ISOtoUNIX.js.js
isotime: 2017-06-08T02:09:54Z
unixts: 1496887794
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
2
Help us understand the problem. What are the problem?