I m working on a scheduled TV on a raspberry pi (raspbian) in javascript/node.js
I extract the information of what to play in a .smil file, and one of the field is scheduled, wich is a string of the format "YYYY-MM-DD hh:mm:ss"
To make comparison between them and the system time, I would like to convert it in UNIX timestamp.
Is there a better way than a function like this one:
function (stime){
var time=0, cache=0, scache;
scache=stime.substr(0, 4);
cache=parseInt(scache);
time=cache*365*24*60*60;
...
return time;
}
And so on for mounth, day...?