/ Published in: ActionScript

actionscript date object and some date calculations
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// create variable dateNow with the current date var dateNow = new Date(); // create variable with specified date var dateBirthday = new Date(1987,2,22); // create variable with date from number var dateFromNumber = new Date(543387600000); // create variable with specified date+time var dateBirthTime = new Date(1987,2,22,1,32); // find a difference between two dates EG. find the number of days til next NYE: // get current year, make date using that with December (month=11), day 31 var NYEdate = new Date((new Date()).getFullYear(), 11, 31); var nowdate = new Date(); // convert difference in milliseconds to days var nDiffDays = Math.floor((NYEdate - nowdate)/86400000); trace(nDiffDays);
Comments
