In my ajax transaction, the date that I am getting returned is in the format 2008-4-10. I need to convert this string to a number like 1211687999. This would be the similar to the php strtotime() function.
Thanks, E
Fotiman
3:51 pm on Apr 10, 2008 (gmt 0)
Something like this?
var strDate = "2008-4-10"; // Assuming 4 = month, 10 = day var arrDate = strDate.split('-'); var myDate = new Date(arrDate[0], arrDate[1], arrDate[2]); alert('The date in number of seconds since 1/1/1970: ' + myDate.getTime()/1000);