0
0

More than 3 years have passed since last update.

現在の日付をUNIX時間に変換する

Last updated at Posted at 2020-06-08

unixtimeとは

UNIX時間(ユニックスじかん)またはUNIX時刻(ユニックスじこく、UNIX time(ユニックスタイム)、POSIX time(ポジックスタイム))とはコンピューターシステム上での時刻表現の一種。
UNIXエポック、すなわち協定世界時 (UTC) での1970年1月1日午前0時0分0秒から形式的な経過秒数(すなわち、実質的な経過秒数から、その間に挿入された閏秒を引き、削除された閏秒を加えたもの)として表される。
GPS時刻などとは異なり、大多数のシステムでは、本当の経過秒数を表すものではない。
wiki

var date = new Date(); // 2020-06-08T09:23:53.264Z

// UNIXタイムスタンプを取得する (ミリ秒単位)
var a = date.getTime(); // 1591608233264

// UNIXタイムスタンプを取得する (秒単位 - PHPのtime()と同じ)
var b = Math.floor( a / 1000 ) ; // 1591608233
0
0
1

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