// 검색일자 초기화
var now:Date = new Date();
fromYYYYMMDD.selectedDate = now; // 검색 : 시작일
toYYYYMMDD.selectedDate = DateUtil.addDays(now,1); // 검색 : 종료일
----------------- dateutil.as
package biz.sehwa.core.utils
{
public class DateUtil
{
public function DateUtil()
{
}
/**
* Add Month
*
* @param date:Date
* @param months:Number Month Count
* @return Date
*/
public static function addMonths(date:Date, months:Number):Date{
var rtnDate:Date = new Date(date.getFullYear(), date.getMonth() + months, date.getDate());
return rtnDate;
}
/**
* Add Week
*
* @param date:Date
* @param weeks:Number Week Count
* @return Date
*/
public static function addWeeks(date:Date, weeks:Number):Date {
return addDays(date, weeks*7);
}
/**
* Add Date
*
* @param date:Date
* @param days:Number Date Count
* @return Date
*/
public static function addDays(date:Date, days:Number):Date {
return addHours(date, days*24);
}
/**
* Add Hours
*
* @param date:Date
* @param hrs:Number Hour Count
* @return Date
*/
public static function addHours(date:Date, hrs:Number):Date {
return addMinutes(date, hrs*60);
}
/**
* Add Minutes
*
* @param date:Date
* @param mins:Number Minute Count
* @return Date
*/
public static function addMinutes(date:Date, mins:Number):Date {
return addSeconds(date, mins*60);
}
/**
* Add Seconds
*
* @param date:Date
* @param secs:Number Seconds Count
* @return Date
*/
public static function addSeconds(date:Date, secs:Number):Date {
var mSecs:Number = secs * 1000;
var sum:Number = mSecs + date.getTime();
return new Date(sum);
}
}
}