[Solved] How to compare two times using ion-datetime?


#1

I need some help guys…

I want use ion-datetime to subtract the hour of two different objects and I’m stucked!

How can a subtract a initial hour from a ion-datetime of a Final Hour of another ion-datetime?


#2

ion-datetime uses a ISO 8601 string for the date/time value. You can simply convert it to millisecond since epoch using Date.parse and use that number to do your calculations.

> new Date().toISOString();
< "2016-10-16T13:47:08.610Z"

> Date.parse("2016-10-16T13:47:08.610Z");
< 1476625628610

#3

Thanks a lot! Solve my problem!!