0

I'm splitting an array, when I take the middle of the array which is reporting as epoch date in milliseconds. I'm testing the date using Epoch Converter and its valid.

I run the date() object and multiply by 1000 to adjust but I'm getting year 4000. I've switched to division just to test if I'm getting too large of a number the year is correct but the day and months are wrong....I've got to be missing something simple:

var jEtrim = item.DTM.split(/[(-]/);
    var date = new Date(jEtrim[1] *1000);

sample output: Thu Jan 08 44037 07:03:20 GMT-0500 (Eastern Standard Time)

Here's the jEtrim: ["/Date", "1343151455000", "0400)/"]

Thanks in advance

Community
  • 1
  • 1
atlMapper
  • 764
  • 3
  • 9
  • 24

1 Answers1

0

Date takes its argument in milliseconds already, so you will not need to multiply by 1000. You will only need to convert it to a number:

new Date(+"1343151455000")
Bergi
  • 630,263
  • 148
  • 957
  • 1,375
  • thanks, that was it...I'm currently learning JS through the Mozilla Dev network, and googling. I hate to keep asking dumb questions if you have any other resources for learning JS I'm open to more sources. – atlMapper Dec 06 '12 at 17:23
  • There's an overview of different tutorials at https://developer.mozilla.org/en-US/learn/javascript. I've found [Eloquent Javascript](http://eloquentjavascript.net/contents.html) to be the best one. – Bergi Dec 06 '12 at 17:27