Tutorial by Examples

function meridiem(d:Date):String { return (d.hours > 11) ? "pm" : "am"; }
/** * @param year Full year as int (ex: 2000). * @param month Month as int, zero-based (ex: 0=January, 11=December). */ function daysInMonth(year:int, month:int):int { return (new Date(year, ++month, 0)).date; }
function isLeapYear(year:int):Boolean { return daysInMonth(year, 1) == 29; }
function isDaylightSavings(d:Date):Boolean { var months:uint = 12; var offset:uint = d.timezoneOffset; var offsetCheck:Number; while (months--) { offsetCheck = (new Date(d.getFullYear(), months, 1)).timezoneOffset; if (offsetCheck != offset) ret...
function today(date:Date = null):Date { if (date == null) date = new Date(); return new Date(date.fullYear, date.month, date.date, 0, 0, 0, 0); }

Page 1 of 1