| Package | vegas.date |
| Class | public class Calendar |
| Inheritance | Calendar Object |
| Method | Defined By | ||
|---|---|---|---|
add(date:Date = null, field:String = null, amount:Number = 0):Date [static]
Adds the specified amount of time to the this instance. | Calendar | ||
after(currentDate:Date = null, date:Date = null):Boolean [static]
Indicates if the current Date object is after the time of specified Date object. | Calendar | ||
antemeridian(date:Date):Boolean [static]
Indicates whether or not the current time is AM. | Calendar | ||
before(currentDate:Date = null, date:Date = null):Boolean [static]
Returns true if the current time of this Calendar is before the time of Calendar when; false otherwise. | Calendar | ||
format(date:Date = null, pattern:String):String [static]
Format the current Calendar date. | Calendar | ||
getCurrentFullMonthCalendar(offset:Number):Array [static]
Returns the array representation of all days in the current month. | Calendar | ||
getDayOffset(date:Date = null, calendarYear:Number):Number [static]
Calculates the number of days the specified date is from January 1 of the specified calendar year. | Calendar | ||
getDaysInMonth(date:Date = null):Number [static]
Returns the numbers of days in a specified month. | Calendar | ||
getFirstDay(date:Date = null, nameFlag:Boolean = false):* [static]
Returns the first day in the specified month. | Calendar | ||
getFullMonthCalendar(date:Date = null, offset:Number):Array [static]
Returns an array representation of all days in a full month. | Calendar | ||
getJan1(calendarYear:Number):Date [static]
Retrieves a Date object representing January 1 of any given year. | Calendar | ||
getNextMonth(date:Date = null):Date [static]
Returns the Date of the next month of the specified Date object. | Calendar | ||
getPreviousMonth(date:Date = null):Date [static]
Returns the Date of the previous month of the specified Date object. | Calendar | ||
getWeekNumber(date:Date = null, calendarYear:Number, weekStartsOn:Number):Number [static]
Calculates the week number for the given date. | Calendar | ||
isEndOfMonth(date:Date = null):Boolean [static]
Returns true if the current or specified Date if the last day in the current or specified month. | Calendar | ||
postmeridian(date:Date):Boolean [static]
Indicates whether or not the current time is PM. | Calendar | ||
subtract(date:Date, field:String, amount:Number):Date [static]
Subtracts the specified amount of time from the this instance. | Calendar | ||
tomorrow(date:Date = null):Date [static]
Returns the Date reference of the "tomorrow" Date object of the specified Date in argument. | Calendar | ||
yesterday(date:Date = null):Date [static]
Returns the Calendar reference of the "yesterday" Calendar object of the specified Date in argument. | Calendar | ||
| Constant | Defined By | ||
|---|---|---|---|
| DAY : String = D [static]
Constant field representing Day ("D"). | Calendar | ||
| DEFAULT_FULL_MONTH_OFFSET : Number = 0 [static]
The default (0) offset use in the getFullMonthCalendar() method. | Calendar | ||
| HOUR : String = h [static]
Constant field representing hours ("h"). | Calendar | ||
| MILLISECOND : String = ms [static]
Constant field representing milliseconds ("ms"). | Calendar | ||
| MINUTE : String = mn [static]
Constant field representing minutes ("mn"). | Calendar | ||
| MONTH : String = M [static]
Constant field representing Month ("M"). | Calendar | ||
| ONE_DAY_MS : Number = 8.64E7 [static]
Constant field representing one day, in milliseconds
| Calendar | ||
| SECOND : String = s [static]
Constant field representing seconds ("s"). | Calendar | ||
| WEEK : String = W [static]
Constant field representing Week ("W"). | Calendar | ||
| YEAR : String = Y [static]
Constant field representing Year ("Y"). | Calendar | ||
| add | () | method |
public static function add(date:Date = null, field:String = null, amount:Number = 0):DateAdds the specified amount of time to the this instance.
Examples :
import vegas.date.Calendar ;
var begin:Date = new Date( 2007, 5 , 14, 11, 30, 0 ) ;
var duration:Number = 50 ;
var end:Date = Calendar.add( begin, Calendar.MINUTE , 50 ) ;
var sBegin:String = Calendar.format(begin , "MM dd yyyy hh:nn:ss") ;
var sFinish:String = Calendar.format(end , "MM dd yyyy hh:nn:ss") ;
trace( "start : " + sBegin ) ;
trace( "finish : " + sFinish ) ;
Parameters
date:Date (default = null) — The Date object to perform addition on.
| |
field:String (default = null) — The this field constant to be used for performing addition.
| |
amount:Number (default = 0) — The number of units (measured in the field constant) to add to the date.
|
Date — the new Date object.
|
| after | () | method |
public static function after(currentDate:Date = null, date:Date = null):BooleanIndicates if the current Date object is after the time of specified Date object.
Example :
import vegas.date.Calendar ;
var d1:Date = new Date(2005, 2, 15) ;
var d2:Date = new Date() ;
trace ("d1 : " + d1) ;
trace ("d2 : " + d2) ;
trace ("# d1 after d2 : " + Calendar.after ( d1 , d2 ) ) ; // false
trace ("# d2 after d1 : " + Calendar.after ( d2 , d1 ) ) ; // true
trace ("# d1 before d2 : " + Calendar.before ( d1 , d2 ) ) ; // true
Parameters
currentDate:Date (default = null) | |
date:Date (default = null) |
Boolean — true if the current Date object is after the time of specified Date object.
|
| antemeridian | () | method |
public static function antemeridian(date:Date):BooleanIndicates whether or not the current time is AM.
Parameters
date:Date |
Boolean |
| before | () | method |
public static function before(currentDate:Date = null, date:Date = null):Boolean
Returns true if the current time of this Calendar is before the time of Calendar when; false otherwise.
Parameters
currentDate:Date (default = null) | |
date:Date (default = null) |
Boolean — true if the current time of this Calendar is before the time of Calendar when; false otherwise.
|
| format | () | method |
public static function format(date:Date = null, pattern:String):StringFormat the current Calendar date.
Parameters
date:Date (default = null) — The String representation of the format pattern.
| |
pattern:String |
String — the format string representation of the current Calendar date.
|
| getCurrentFullMonthCalendar | () | method |
public static function getCurrentFullMonthCalendar(offset:Number):ArrayReturns the array representation of all days in the current month.
Parameters
offset:Number — the day offset value between 0 and 6 to fill the calendar. The default value is 0 (Sunday).
|
Array — the array representation of all days in the current month.
|
| getDayOffset | () | method |
public static function getDayOffset(date:Date = null, calendarYear:Number):NumberCalculates the number of days the specified date is from January 1 of the specified calendar year. Passing January 1 to this function would return an offset value of zero.
Parameters
date:Date (default = null) — The Date for which to find the offset
| |
calendarYear:Number (default = NaN) — The calendar year to use for determining the offset
|
Number — The number of days since January 1 of the given year
|
| getDaysInMonth | () | method |
public static function getDaysInMonth(date:Date = null):NumberReturns the numbers of days in a specified month.
Parameters
date:Date (default = null) — The specified Date object.
|
Number — the numbers of days in a specified month.
|
| getFirstDay | () | method |
public static function getFirstDay(date:Date = null, nameFlag:Boolean = false):*Returns the first day in the specified month.
Parameters
date:Date (default = null) — The specified Date object of this method.
| |
nameFlag:Boolean (default = false) — The first day return value is a Number if the argument is false or the name of the day with a string representation if the flag is true.
|
* — the first day in the specified month.
|
| getFullMonthCalendar | () | method |
public static function getFullMonthCalendar(date:Date = null, offset:Number):ArrayReturns an array representation of all days in a full month. The array can begin with null values if the first day in the first week are previous days of the previous month.
Example :
import vegas.date.Calendar ;
var ar:Array = Calendar.getFullMonthCalendar( new Date(2007,03) , 1 ) ;
trace(ar) ;
Parameters
date:Date (default = null) — (optional) The specified Date to return the full month calendar. The default value is the current Date object.
| |
offset:Number (default = NaN) — the day offset value between 0 and 6 to fill the calendar. The default value is 0 (Sunday).
|
Array — an array representation of a full month.
|
| getJan1 | () | method |
public static function getJan1(calendarYear:Number):DateRetrieves a Date object representing January 1 of any given year.
Parameters
calendarYear:Number (default = NaN) — The calendar year for which to retrieve January 1
|
Date — January 1 of the calendar year specified.
|
| getNextMonth | () | method |
public static function getNextMonth(date:Date = null):Date
Returns the Date of the next month of the specified Date object.
Parameters
date:Date (default = null) |
Date — the Data of the next month of the specified Date object.
|
| getPreviousMonth | () | method |
public static function getPreviousMonth(date:Date = null):Date
Returns the Date of the previous month of the specified Date object.
Parameters
date:Date (default = null) |
Date — the Date of the previous month of the specified Date object.
|
| getWeekNumber | () | method |
public static function getWeekNumber(date:Date = null, calendarYear:Number, weekStartsOn:Number):NumberCalculates the week number for the given date. This function assumes that week 1 is the week in which January 1 appears, regardless of whether the week consists of a full 7 days. The calendar year can be specified to help find what a the week number would be for a given date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction easily.
Parameters
date:Date (default = null) — The date for which to find the week number
| |
calendarYear:Number (default = NaN) — (optional) The calendar year to use for determining the week number. Default is the calendar year of parameter "date".
| |
weekStartsOn:Number (default = NaN) — (optional) The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
|
Number — The week number of the given date.
|
| isEndOfMonth | () | method |
public static function isEndOfMonth(date:Date = null):Boolean
Returns true if the current or specified Date if the last day in the current or specified month.
Parameters
date:Date (default = null) |
Boolean — true if the current or specified Date if the last day in the current or specified month.
|
| postmeridian | () | method |
public static function postmeridian(date:Date):BooleanIndicates whether or not the current time is PM.
Parameters
date:Date |
Boolean |
| subtract | () | method |
public static function subtract(date:Date, field:String, amount:Number):DateSubtracts the specified amount of time from the this instance.
Parameters
date:Date — The Date object to perform subtraction on
| |
field:String — The this field constant to be used for performing subtraction.
| |
amount:Number — The number of units (measured in the field constant) to subtract from the date.
|
Date — the new Calendar object.
|
| tomorrow | () | method |
public static function tomorrow(date:Date = null):Date
Returns the Date reference of the "tomorrow" Date object of the specified Date in argument.
Example :
trace ( "toDay : " + (new Calendar()).format("DDDD yyyy-mm-dd") ) ;
trace ( "tomorrow : " + (Calendar.tomorrow()).format("DDDD yyyy-mm-dd") ) ;
Parameters
date:Date (default = null) |
Date — the Date reference of the "tomorrow" Date object of the specified Date in argument.
|
| yesterday | () | method |
public static function yesterday(date:Date = null):Date
Returns the Calendar reference of the "yesterday" Calendar object of the specified Date in argument.
Example :
trace ( "yesterday : " + (Calendar.yesterday()).format("DDDD yyyy-mm-dd") ) ;
trace ( "toDay : " + (new Calendar()).format("DDDD yyyy-mm-dd") ) ;
Parameters
date:Date (default = null) |
Date — the Calendar reference of the "yesterday" Calendar object of the specified Date in argument.
|
| DAY | Constant |
public static const DAY:String = DConstant field representing Day ("D").
| DEFAULT_FULL_MONTH_OFFSET | Constant |
public static const DEFAULT_FULL_MONTH_OFFSET:Number = 0The default (0) offset use in the getFullMonthCalendar() method.
| HOUR | Constant |
public static const HOUR:String = hConstant field representing hours ("h").
| MILLISECOND | Constant |
public static const MILLISECOND:String = msConstant field representing milliseconds ("ms").
| MINUTE | Constant |
public static const MINUTE:String = mnConstant field representing minutes ("mn").
| MONTH | Constant |
public static const MONTH:String = MConstant field representing Month ("M").
| ONE_DAY_MS | Constant |
public static const ONE_DAY_MS:Number = 8.64E7Constant field representing one day, in milliseconds
| SECOND | Constant |
public static const SECOND:String = sConstant field representing seconds ("s").
| WEEK | Constant |
public static const WEEK:String = WConstant field representing Week ("W").
| YEAR | Constant |
public static const YEAR:String = YConstant field representing Year ("Y").