0

So if i see '1328571956' as the value for the current visit, how do I decode that to a readable value?

thx

justSteve
  • 5,444
  • 19
  • 72
  • 137
  • That's seconds after the start of the UNIX epoch (1 Jan 1970, 0:00 UTC). – Wooble Feb 07 '12 at 00:24
  • So it's literally the native date value of Javascript as explained via http://www.epochconverter.com/programming/. Wanting cred for the answer? & thx much – justSteve Feb 07 '12 at 00:35

3 Answers3

1

It's a UNIX timestamp. For decoding it into a usable JavaScript date object, there's this: Convert a Unix timestamp to time in JavaScript

Community
  • 1
  • 1
Seabass
  • 1,963
  • 12
  • 15
1

As @wooble above stated... "That's seconds after the start of the UNIX epoch (1 Jan 1970, 0:00 UTC)"

To use it though, do this...

var date = new Date(1328571956).toString();
jcreamer898
  • 8,109
  • 5
  • 41
  • 56
1

don't forget to multiply seconds by 1000 for unix to javascript timestamps:

Date.fromUnix=function(n){
    return new Date(n*1000);
}

alert(Date.fromUnix(1328571956).toUTCString());

kennebec
  • 102,654
  • 32
  • 106
  • 127