3

How do I convert this into timestamp

Datetime = 2014-07-14T09:34:47.000Z

Timestamp = ?

Ajey
  • 7,498
  • 11
  • 58
  • 84

2 Answers2

4
var Datetime = "2014-07-14T09:34:47.000Z";
new Date(Datetime).getTime();

This will return the number of milliseconds since the epoch.

dersvenhesse
  • 6,015
  • 2
  • 28
  • 50
Husman
  • 6,579
  • 7
  • 28
  • 46
1

Try this:

function getTimeStamp(dateStr) { //example: "2014-07-14T09:34:47"
  var s = new Date(dateStr); 
  return s.getFullYear()*10000000000 + (s.getMonth()+1)*100000000 + s.getDate()*1000000 + s.getHours()*10000 + s.getMinutes()*100 + s.getSeconds();
}

Note that you have to remove the milliseconds from your example.

zarkobehar
  • 191
  • 1
  • 4