Packagevegas.date
Classpublic class Time
InheritanceTime Inheritance Object

The Time object is a holder for a time difference.

Time splits a time difference (distance between two dates) into days, hours, minutes, seconds and milliseconds to offers methods to access the time difference value.



Public Properties
 PropertyDefined By
  days : Number
Amount of days.
Time
  doEval : Boolean = true
Flag if the instance need to be evaluated by evaluate.
Time
  hours : Number
Amount of hours.
Time
  milliSeconds : Number
Amount of milliseconds.
Time
  minutes : Number
Amount of minutes.
Time
  ms : Number
Time difference in ms.
Time
  seconds : Number
Amount of seconds.
Time
Public Methods
 MethodDefined By
  
Time(timeDifference:Number = 0, format:String = ms)
Creates a new Time instance.
Time
  
evaluate():void
Splits the time distance from ms (source value) into the different units.
Time
  
getDays(round:Number):Number
Returns the amount of days are contained within the time.
Time
  
getHours(round:Number):Number
Returns the amount of hours are contained within the time.
Time
  
getMilliseconds(round:Number):Number
Returns the amount of milliseconds are contained within the time.
Time
  
getMinutes(round:Number):Number
Returns the amount of minutes are contained within the time.
Time
  
getSeconds(round:Number):Number
Returns the amount of seconds are contained within the time.
Time
  
inDays():Number
Returns the time distance in days.
Time
  
inHours():Number
Returns the time distance in hours.
Time
  
Returns the time difference in milliseconds.
Time
  
inMinutes():Number
Returns the time distance in minutes.
Time
  
inSeconds():Number
Returns The time difference in seconds.
Time
  
minus(timeDifference:Time):Time
Removes the passed-in timeDifference from the current time.
Time
  
plus(timeDifference:Time):Time
Adds the passed-in timedistance to the current time.
Time
  
setValue(timeDifference:Number, format:String = ms):Time
Sets the time of the instance.
Time
  
valueOf():Number
Returns the value of the time distance (in ms).
Time
Public Constants
 ConstantDefined By
  DAY : Number = 8.64E7
[static] Factor from ms to day.
Time
  DAY_FORMAT : String = d
[static] The 'day' string representation to format the unit amount time value.
Time
  HOUR : Number = 3600000.0
[static] Factor from ms to hour.
Time
  HOUR_FORMAT : String = h
[static] The 'hour' string representation to format the unit amount time value.
Time
  MILLISECOND_FORMAT : String = ms
[static] The 'millisecond' string representation to format the unit amount time value.
Time
  MINUTE : Number = 60000.0
[static] Factor from ms to minute.
Time
  MINUTE_FORMAT : String = m
[static] The 'minute' string representation to format the unit amount time value.
Time
  SECOND : Number = 1000
[static] Factor from ms to second.
Time
  SECOND_FORMAT : String = s
[static] The 'second' string representation to format the unit amount time value.
Time
Property Detail
daysproperty
public var days:Number

Amount of days.

doEvalproperty 
public var doEval:Boolean = true

Flag if the instance need to be evaluated by evaluate.

hoursproperty 
public var hours:Number

Amount of hours.

milliSecondsproperty 
public var milliSeconds:Number

Amount of milliseconds.

minutesproperty 
public var minutes:Number

Amount of minutes.

msproperty 
public var ms:Number

Time difference in ms.

secondsproperty 
public var seconds:Number

Amount of seconds.

Constructor Detail
Time()Constructor
public function Time(timeDifference:Number = 0, format:String = ms)

Creates a new Time instance.

Parameters
timeDifference:Number (default = 0) — The time size of the time difference for the passed-in format.
 
format:String (default = ms) — (optional) "d"/"h"/"m"/"s"/"ms" for the unit of the amout, default case is "ms".
Method Detail
evaluate()method
public function evaluate():void

Splits the time distance from ms (source value) into the different units.

getDays()method 
public function getDays(round:Number):Number

Returns the amount of days are contained within the time.

It will not round the result if you pass-in nothing.

Parameters

round:Number (default = NaN) — (optional) the number of decimal spaces

Returns
Number — The time difference in days.
getHours()method 
public function getHours(round:Number):Number

Returns the amount of hours are contained within the time.

It will not round the result if you pass-in nothing.

Parameters

round:Number (default = NaN) — (optional) the number of decimal spaces

Returns
Number — The time difference in hours.
getMilliseconds()method 
public function getMilliseconds(round:Number):Number

Returns the amount of milliseconds are contained within the time.

It will not round the result if you pass-in nothing.

Parameters

round:Number (default = NaN) — (optional) the number of decimal spaces.

Returns
Number — The time difference in milliseconds.
getMinutes()method 
public function getMinutes(round:Number):Number

Returns the amount of minutes are contained within the time.

It will not round the result if you pass-in nothing.

Parameters

round:Number (default = NaN) — (optional) the number of decimal spaces

Returns
Number — The time difference in minutes.
getSeconds()method 
public function getSeconds(round:Number):Number

Returns the amount of seconds are contained within the time.

It will not round the result if you pass-in nothing.

Parameters

round:Number (default = NaN) — (optional) the number of decimal spaces

Returns
Number — The time difference in seconds
inDays()method 
public function inDays():Number

Returns the time distance in days.

Returns
Number — The time difference in days.
inHours()method 
public function inHours():Number

Returns the time distance in hours.

Returns
Number — The time difference in hours.
inMilliSeconds()method 
public function inMilliSeconds():Number

Returns the time difference in milliseconds.

Returns
Number — the time difference in milliseconds.
inMinutes()method 
public function inMinutes():Number

Returns the time distance in minutes.

Returns
Number — The time difference in minutes.
inSeconds()method 
public function inSeconds():Number

Returns The time difference in seconds.

Returns
Number — The time difference in seconds.
minus()method 
public function minus(timeDifference:Time):Time

Removes the passed-in timeDifference from the current time.

Parameters

timeDifference:Time — time difference to be removed from the current time

Returns
Time — A new instance with the resulting amount of time
plus()method 
public function plus(timeDifference:Time):Time

Adds the passed-in timedistance to the current time.

Parameters

timeDifference:Time — time difference to be added to the current time.

Returns
Time — A new instance with the resulting amount of time.
setValue()method 
public function setValue(timeDifference:Number, format:String = ms):Time

Sets the time of the instance.

Uses "ms" if no format or a wrong format was passed-in.

Uses Number.MAX_VALUE if Infinity was passed-in.

Parameters

timeDifference:Number (default = NaN) — size of the time difference for the passed-in format
 
format:String (default = ms) — (optional) "d"/"h"/"m"/"s"/"ms" for the unit of the amout. Default value is ms.

Returns
Time
valueOf()method 
public function valueOf():Number

Returns the value of the time distance (in ms).

Returns
Number — The value of this object in ms.
Constant Detail
DAYConstant
public static const DAY:Number = 8.64E7

Factor from ms to day.

DAY_FORMATConstant 
public static const DAY_FORMAT:String = d

The 'day' string representation to format the unit amount time value.

HOURConstant 
public static const HOUR:Number = 3600000.0

Factor from ms to hour.

HOUR_FORMATConstant 
public static const HOUR_FORMAT:String = h

The 'hour' string representation to format the unit amount time value.

MILLISECOND_FORMATConstant 
public static const MILLISECOND_FORMAT:String = ms

The 'millisecond' string representation to format the unit amount time value.

MINUTEConstant 
public static const MINUTE:Number = 60000.0

Factor from ms to minute.

MINUTE_FORMATConstant 
public static const MINUTE_FORMAT:String = m

The 'minute' string representation to format the unit amount time value.

SECONDConstant 
public static const SECOND:Number = 1000

Factor from ms to second.

SECOND_FORMATConstant 
public static const SECOND_FORMAT:String = s

The 'second' string representation to format the unit amount time value.