How can i convert date which looks like this 12092008 to unixtime like this 1221215809
3 Answers
This worked for me.
var day = $("#day").val();
var month = $("#month").val();
var year = $("#year").val();
var date = new Date();
date.setFullYear(year, month, day)
var unixtimeMS = date.getTime();
var unixtime = parseInt(unixtimeMS / 1000);
alert(unixtime);
1 Comment
Pointy
You need to be very careful with this - remember that the clocks on your clients' computers may not be set to the same time zone as your servers.