2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Posted at

こんなかんじで

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
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?