1

I am getting from this Url the Datetime->

http://193.70.60.44:3000/taxi_server/api/v1.0/ride_request

"requestdatetime":"2017-03-16T20:37:18.494Z"

and i want to compare it with the datetime of now.

How can i compare this format in javascript?

  • Possible duplicate of [How to check if input date is equal to today's date?](http://stackoverflow.com/questions/8215556/how-to-check-if-input-date-is-equal-to-todays-date) – Koby Douek Mar 16 '17 at 17:59
  • That's a format that a) can be parsed using the native [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) b) can be compared lexically if you need – Bergi Mar 16 '17 at 18:24

1 Answers1

1

You could calculate the milliseconds:

var milliseconds = (new Date()).getTime() - Date.parse('2017-03-16T20:37:18.494Z');

caisah
  • 1,959
  • 1
  • 21
  • 31