Am trying to learn angular2+ and i want to make a GoogleCalendar's like scheduler app. After many research, i decided to use PrimeNG. The output format of the calendar is
2016-01-16T16:00:00
that's seems great and complete. But the api i want to interract with uses timeStamp...
I tried to make a Javascript function who's parsing my date format :
function toTimestamp(strDate){
var datum = Date.parse(strDate);
return datum/1000;
}
alert(toTimestamp('02/13/2009 23:31:30'));
But my problem is that i can't use the format of PrimeNG...
Did anyone know how can i interact corectly with the format i need to convert to a timestamp?
else did anyone know how can i get this date format ( 2016-01-16T16:00:00 ) to a timestamp using angular2+ ? Thanks very much !!
You can use plain javascript:
let time = new Date("2016-01-16T16:00:00");
alert(time.getTime());
This will return you a timestamp. Just be aware of timezones.