public class Util
{
public function Util()
{
}
public function dateAdd(datepart:String=””, number:Number=0, date:Date=null):Date {
if (date==null) {
date=new Date();
}
var returnDate:Date=new Date(date.time);;
switch (datepart.toLowerCase()) {
case “fullyear”:
case “month”:
case “date”:
case “hours”:
case “minutes”:
case “seconds”:
case “milliseconds”:
returnDate[datepart] +=number;
break;
default:
break;
}
return returnDate;
}
public function dateDiff(dataBegin:Date,dateEnd:Date):Number{
var diff:Number=(dateEnd.time-dataBegin.time)/new Number(24*60*60*1000);
return diff;
}
public function dateCompare(date1:Date, date2:Date):int {
if (Number(date1) < Number(date2)) {
return -1
}
if (Number(date1)==Number(date2)) {
return 0;
}
return 1;
}
}