22

I am unable to understand the expiry date format of the JWT embedded in my application.

For example: 1473912000

What does this translate to? 1473912000 ms, some x date? Any help will be appreciated!

YakovL
  • 7,557
  • 12
  • 62
  • 102
Sarim Zafar
  • 263
  • 1
  • 3
  • 7

3 Answers3

40

Like James has pointed out:

The number is the number of seconds since Jan 1 1970.

This is converted into the Date object in a quite straight-forward way (the *1000 part is here because in JS main time unit is millisecond):

const expiryDate = new Date(1473912000*1000);

Then you can use any Date method you please.

Likewise, in Ruby you can use Time.at(1473912000) to create a new Time instance like Maxim has shown.

YakovL
  • 7,557
  • 12
  • 62
  • 102
7

The number is the number of seconds since Jan 1 1970. It is commonly used on unix systems to represent time. Your time is 2016-09-15 04:00 (UTC)

To convert you can try a web based system http://www.unixtimestamp.com/index.php

James K
  • 3,692
  • 1
  • 28
  • 36
5

This is UNIX time in seconds:

➜  ~ irb
2.2.0 :001 > Time.at(1473912000)
 => 2016-09-15 07:00:00 +0300
Maxim
  • 9,701
  • 5
  • 60
  • 108