var seconds = new Date(year, month, day, hours, minutes, seconds, 0).getTime() / 1000;
The above will give seconds from 1-1 to 1970. getTime() gives milliseconds, therefore it is divided by 1000. Note (as mentioned by Aler Close), the month varies from 0-11, so you may need to fix this compared to mktime
function java_mktime(hour,minute,month,day,year) { return new Date(year, month - 1, day, hour, minutes 0, 0).getTime() / 1000; }
bart s
source share