Packagecom.developmentarc.framework.utils
Classpublic class AdjustableDate

The AdjustableDate Class is a utility that provides a proxy wrapper around a Date object and contains utility methods intended for helping manage the Date instance. The Date object is a Final class so a proxy pattern must be used to expose the date methods on the AdjustableDate.

The AdjustableDate provides helper methods to quickly change the date value by milliseconds, seconds, minutes, hours, days, months and years. Instead of having to set the values you can offset a Date by 4 months by using the offsetYears() method and passing in 4 as the argument. This will then move the date forward by 4 years.

The AdjustableDate also can determine if the date is a leap year and also provides access to the internal date class.



Public Properties
 PropertyDefined by
  date : Number
The day of the month (an integer from 1 to 31) specified by a Date object according to local time.
AdjustableDate
  dateInstance : Date
[read-only] Provides access to the internal date instance.
AdjustableDate
  dateUTC : Number
The day of the month (an integer from 1 to 31) of a Date object according to universal time (UTC).
AdjustableDate
  day : Number
[read-only] The day of the week (0 for Sunday, 1 for Monday, and so on) specified by this Date according to local time.
AdjustableDate
  dayUTC : Number
[read-only] The day of the week (0 for Sunday, 1 for Monday, and so on) of this Date according to universal time (UTC).
AdjustableDate
  fullYear : Number
The full year (a four-digit number, such as 2000) of a Date object according to local time.
AdjustableDate
  fullYearUTC : Number
The four-digit year of a Date object according to universal time (UTC).
AdjustableDate
  hours : Number
The hour (an integer from 0 to 23) of the day portion of a Date object according to local time.
AdjustableDate
  hoursUTC : Number
The hour (an integer from 0 to 23) of the day of a Date object according to universal time (UTC).
AdjustableDate
  milliseconds : Number
The milliseconds (an integer from 0 to 999) portion of a Date object according to local time.
AdjustableDate
  millisecondsUTC : Number
The milliseconds (an integer from 0 to 999) portion of a Date object according to universal time (UTC).
AdjustableDate
  minutes : Number
The minutes (an integer from 0 to 59) portion of a Date object according to local time.
AdjustableDate
  minutesUTC : Number
The minutes (an integer from 0 to 59) portion of a Date object according to universal time (UTC).
AdjustableDate
  month : Number
The month (0 for January, 1 for February, and so on) portion of a Date object according to local time.
AdjustableDate
  monthUTC : Number
The month (0 [January] to 11 [December]) portion of a Date object according to universal time (UTC).
AdjustableDate
  seconds : Number
The seconds (an integer from 0 to 59) portion of a Date object according to local time.
AdjustableDate
  secondsUTC : Number
The seconds (an integer from 0 to 59) portion of a Date object according to universal time (UTC).
AdjustableDate
  sinceEpoch : Number
[read-only] The number of seconds since midnight January 1, 1970, universal time, for a Date object.
AdjustableDate
  time : Number
The number of milliseconds since midnight January 1, 1970, universal time, for a Date object.
AdjustableDate
  timezoneOffset : Number
[read-only] The difference, in minutes, between universal time (UTC) and the computer's local time.
AdjustableDate
Public Methods
 MethodDefined by
  
AdjustableDate(yearOrTime:Object = null, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0)
AdjustableDate
  
isLeapYear(year:Number):Boolean
[static] Determines if the provided year is a leap year.
AdjustableDate
  
offsetDays(amount:int):void
Change the current AdjustableDate's days value by passing in a postitive or negative number.
AdjustableDate
  
offsetHours(amount:int):void
Change the current AdjustableDate's hours value by passing in a postitive or negative number.
AdjustableDate
  
offsetMilliseconds(amount:Number):void
Change the current AdjustableDate's milliseconds value by passing in a postitive or negative number.
AdjustableDate
  
offsetMinutes(amount:int):void
Change the current AdjustableDate's minutes value by passing in a postitive or negative number.
AdjustableDate
  
offsetMonths(amount:int):void
Change the current AdjustableDate's months value by passing in a postitive or negative number.
AdjustableDate
  
offsetSeconds(amount:int):void
Change the current AdjustableDate's seconds value by passing in a postitive or negative number.
AdjustableDate
  
offsetYears(amount:int):void
Change the current AdjustableDate's years value by passing in a postitive or negative number.
AdjustableDate
  
toDateString():String
Returns a string representation of the day and date only, and does not include the time or timezone.
AdjustableDate
  
Returns a String representation of the day and date only, and does not include the time or timezone.
AdjustableDate
  
toLocaleString():String
Returns a String representation of the day, date, time, given in local time.
AdjustableDate
  
Returns a String representation of the time only, and does not include the day, date, year, or timezone.
AdjustableDate
  
toString():String
Returns a String representation of the day, date, time, and timezone.
AdjustableDate
  
toTimeString():String
Returns a String representation of the time and timezone only, and does not include the day and date.
AdjustableDate
  
toUTCString():String
Returns a String representation of the day, date, and time in universal time (UTC).
AdjustableDate
Property detail
dateproperty
date:Number  [read-write]

The day of the month (an integer from 1 to 31) specified by a Date object according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get date():Number
    public function set date(value:Number):void
dateInstanceproperty 
dateInstance:Date  [read-only]

Provides access to the internal date instance.

Implementation
    public function get dateInstance():Date
dateUTCproperty 
dateUTC:Number  [read-write]

The day of the month (an integer from 1 to 31) of a Date object according to universal time (UTC).

Implementation
    public function get dateUTC():Number
    public function set dateUTC(value:Number):void
dayproperty 
day:Number  [read-only]

The day of the week (0 for Sunday, 1 for Monday, and so on) specified by this Date according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get day():Number
dayUTCproperty 
dayUTC:Number  [read-only]

The day of the week (0 for Sunday, 1 for Monday, and so on) of this Date according to universal time (UTC).

Implementation
    public function get dayUTC():Number
fullYearproperty 
fullYear:Number  [read-write]

The full year (a four-digit number, such as 2000) of a Date object according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get fullYear():Number
    public function set fullYear(value:Number):void
fullYearUTCproperty 
fullYearUTC:Number  [read-write]

The four-digit year of a Date object according to universal time (UTC).

Implementation
    public function get fullYearUTC():Number
    public function set fullYearUTC(value:Number):void
hoursproperty 
hours:Number  [read-write]

The hour (an integer from 0 to 23) of the day portion of a Date object according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get hours():Number
    public function set hours(value:Number):void
hoursUTCproperty 
hoursUTC:Number  [read-write]

The hour (an integer from 0 to 23) of the day of a Date object according to universal time (UTC).

Implementation
    public function get hoursUTC():Number
    public function set hoursUTC(value:Number):void
millisecondsproperty 
milliseconds:Number  [read-write]

The milliseconds (an integer from 0 to 999) portion of a Date object according to local time. Local time is determined by the operating system on which Flash Player is running

Implementation
    public function get milliseconds():Number
    public function set milliseconds(value:Number):void
millisecondsUTCproperty 
millisecondsUTC:Number  [read-write]

The milliseconds (an integer from 0 to 999) portion of a Date object according to universal time (UTC).

Implementation
    public function get millisecondsUTC():Number
    public function set millisecondsUTC(value:Number):void
minutesproperty 
minutes:Number  [read-write]

The minutes (an integer from 0 to 59) portion of a Date object according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get minutes():Number
    public function set minutes(value:Number):void
minutesUTCproperty 
minutesUTC:Number  [read-write]

The minutes (an integer from 0 to 59) portion of a Date object according to universal time (UTC).

Implementation
    public function get minutesUTC():Number
    public function set minutesUTC(value:Number):void
monthproperty 
month:Number  [read-write]

The month (0 for January, 1 for February, and so on) portion of a Date object according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get month():Number
    public function set month(value:Number):void
monthUTCproperty 
monthUTC:Number  [read-write]

The month (0 [January] to 11 [December]) portion of a Date object according to universal time (UTC).

Implementation
    public function get monthUTC():Number
    public function set monthUTC(value:Number):void
secondsproperty 
seconds:Number  [read-write]

The seconds (an integer from 0 to 59) portion of a Date object according to local time. Local time is determined by the operating system on which Flash Player is running.

Implementation
    public function get seconds():Number
    public function set seconds(value:Number):void
secondsUTCproperty 
secondsUTC:Number  [read-write]

The seconds (an integer from 0 to 59) portion of a Date object according to universal time (UTC).

Implementation
    public function get secondsUTC():Number
    public function set secondsUTC(value:Number):void
sinceEpochproperty 
sinceEpoch:Number  [read-only]

The number of seconds since midnight January 1, 1970, universal time, for a Date object. Use this method to represent a specific instant in time when comparing two or more AdjustableDate objects.

Implementation
    public function get sinceEpoch():Number
timeproperty 
time:Number  [read-write]

The number of milliseconds since midnight January 1, 1970, universal time, for a Date object. Use this method to represent a specific instant in time when comparing two or more AdjustableDate objects.

Implementation
    public function get time():Number
    public function set time(value:Number):void
timezoneOffsetproperty 
timezoneOffset:Number  [read-only]

The difference, in minutes, between universal time (UTC) and the computer's local time. Specifically, this value is the number of minutes you need to add to the computer's local time to equal UTC. If your computer's time is set later than UTC, the value will be negative.

Implementation
    public function get timezoneOffset():Number
Constructor detail
AdjustableDate()constructor
public function AdjustableDate(yearOrTime:Object = null, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0)

Parameters
yearOrTime:Object (default = null)
 
month:Number
 
date:Number (default = 1)
 
hour:Number (default = 0)
 
minute:Number (default = 0)
 
second:Number (default = 0)
 
millisecond:Number (default = 0)
Method detail
isLeapYear()method
public static function isLeapYear(year:Number):Boolean

Determines if the provided year is a leap year.

Parameters
year:Number — The year to verify, should be in 4 digit YYYY format.

Returns
Boolean — True if year is a leap year, false if not.
offsetDays()method 
public function offsetDays(amount:int):void

Change the current AdjustableDate's days value by passing in a postitive or negative number.

For example: To set the current time back 5 days you would pass in -5. To set the current time forward 5 days you would pass in 5.

Parameters
amount:int — The number of days to change the current time by.
offsetHours()method 
public function offsetHours(amount:int):void

Change the current AdjustableDate's hours value by passing in a postitive or negative number.

For example: To set the current time back 5 hours you would pass in -5. To set the current time forward 5 hours you would pass in 5.

Parameters
amount:int — The number of hours to change the current time by.
offsetMilliseconds()method 
public function offsetMilliseconds(amount:Number):void

Change the current AdjustableDate's milliseconds value by passing in a postitive or negative number.

For example: To set the current time back 500 milliseconds you would pass in -500. To set the current time forward 500 milliseconds you would pass in 500.

Parameters
amount:Number — The number of milliseconds to change the current time by.
offsetMinutes()method 
public function offsetMinutes(amount:int):void

Change the current AdjustableDate's minutes value by passing in a postitive or negative number.

For example: To set the current time back 20 minutes you would pass in -20. To set the current time forward 20 minutes you would pass in 20.

Parameters
amount:int — The number of minutes to change the current time by.
offsetMonths()method 
public function offsetMonths(amount:int):void

Change the current AdjustableDate's months value by passing in a postitive or negative number. This method proplery adjusts the months as they pass over years, leap years, etc.

For example: To set the current time back 5 months you would pass in -5. To set the current time forward 5 months you would pass in 5.

Parameters
amount:int — The number of months to change the current time by.
offsetSeconds()method 
public function offsetSeconds(amount:int):void

Change the current AdjustableDate's seconds value by passing in a postitive or negative number.

For example: To set the current time back 10 seconds you would pass in -10. To set the current time forward 10 seconds you would pass in 10.

Parameters
amount:int — The number of seconds to change the current time by.
offsetYears()method 
public function offsetYears(amount:int):void

Change the current AdjustableDate's years value by passing in a postitive or negative number.

For example: To set the current time back 5 years you would pass in -5. To set the current time forward 5 years you would pass in 5.

Parameters
amount:int — The number of years to change the current time by.
toDateString()method 
public function toDateString():String

Returns a string representation of the day and date only, and does not include the time or timezone. Contrast with the following methods:

Returns
String — The string representation of day and date only.
toLocaleDateString()method 
public function toLocaleDateString():String

Returns a String representation of the day and date only, and does not include the time or timezone. This method returns the same value as AdjustableDate.toDateString. Contrast with the following methods:

Returns
String — The String representation of day and date only.
toLocaleString()method 
public function toLocaleString():String

Returns a String representation of the day, date, time, given in local time. Contrast with the AdjustableDate.toString() method, which returns the same information (plus the timezone) with the year listed at the end of the string.

Returns
String — The string representation of time and timezone only.
toLocaleTimeString()method 
public function toLocaleTimeString():String

Returns a String representation of the time only, and does not include the day, date, year, or timezone. Contrast with the Date.toTimeString() method, which returns the time and timezone.

Returns
String — The string representation of time and timezone only.
toString()method 
public function toString():String

Returns a String representation of the day, date, time, and timezone. The date format for the output is: Day Mon Date HH:MM:SS TZD YYYY

For example: Wed Apr 12 15:30:17 GMT-0700 2006

Returns
String — The string representation of a Date object.
toTimeString()method 
public function toTimeString():String

Returns a String representation of the time and timezone only, and does not include the day and date. Contrast with the AdjustableDate.toDateString() method, which returns only the day and date.

Returns
String — The string representation of time and timezone only.
toUTCString()method 
public function toUTCString():String

Returns a String representation of the day, date, and time in universal time (UTC). For example, the date February 1, 2005 is returned as Tue Feb 1 00:00:00 2005 UTC.

Returns
String — The string representation of a Date object in UTC time.