| Package | vegas.date |
| Class | public class Time |
| Inheritance | Time Object |
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.
| Property | Defined 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 | ||
| Method | Defined 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 | ||
inMilliSeconds():Number
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 | ||
Removes the passed-in timeDifference from the current time. | Time | ||
Adds the passed-in timedistance to the current time. | Time | ||
Sets the time of the instance. | Time | ||
valueOf():Number
Returns the value of the time distance (in ms). | Time | ||
| Constant | Defined 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 | ||
| days | property |
public var days:NumberAmount of days.
| doEval | property |
public var doEval:Boolean = trueFlag if the instance need to be evaluated by evaluate.
| hours | property |
public var hours:NumberAmount of hours.
| milliSeconds | property |
public var milliSeconds:NumberAmount of milliseconds.
| minutes | property |
public var minutes:NumberAmount of minutes.
| ms | property |
public var ms:NumberTime difference in ms.
| seconds | property |
public var seconds:NumberAmount of seconds.
| Time | () | Constructor |
public function Time(timeDifference:Number = 0, format:String = ms)
Creates a new Time instance.
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".
|
| evaluate | () | method |
public function evaluate():voidSplits the time distance from ms (source value) into the different units.
| getDays | () | method |
public function getDays(round:Number):NumberReturns 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
|
Number — The time difference in days.
|
| getHours | () | method |
public function getHours(round:Number):NumberReturns 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
|
Number — The time difference in hours.
|
| getMilliseconds | () | method |
public function getMilliseconds(round:Number):NumberReturns 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.
|
Number — The time difference in milliseconds.
|
| getMinutes | () | method |
public function getMinutes(round:Number):NumberReturns 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
|
Number — The time difference in minutes.
|
| getSeconds | () | method |
public function getSeconds(round:Number):NumberReturns 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
|
Number — The time difference in seconds
|
| inDays | () | method |
public function inDays():NumberReturns the time distance in days.
ReturnsNumber — The time difference in days.
|
| inHours | () | method |
public function inHours():NumberReturns the time distance in hours.
ReturnsNumber — The time difference in hours.
|
| inMilliSeconds | () | method |
public function inMilliSeconds():NumberReturns the time difference in milliseconds.
ReturnsNumber — the time difference in milliseconds.
|
| inMinutes | () | method |
public function inMinutes():NumberReturns the time distance in minutes.
ReturnsNumber — The time difference in minutes.
|
| inSeconds | () | method |
public function inSeconds():NumberReturns The time difference in seconds.
ReturnsNumber — 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
|
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.
|
Time — A new instance with the resulting amount of time.
|
| setValue | () | method |
public function setValue(timeDifference:Number, format:String = ms):TimeSets 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.
|
Time |
| valueOf | () | method |
public function valueOf():NumberReturns the value of the time distance (in ms).
ReturnsNumber — The value of this object in ms.
|
| DAY | Constant |
public static const DAY:Number = 8.64E7Factor from ms to day.
| DAY_FORMAT | Constant |
public static const DAY_FORMAT:String = dThe 'day' string representation to format the unit amount time value.
| HOUR | Constant |
public static const HOUR:Number = 3600000.0Factor from ms to hour.
| HOUR_FORMAT | Constant |
public static const HOUR_FORMAT:String = hThe 'hour' string representation to format the unit amount time value.
| MILLISECOND_FORMAT | Constant |
public static const MILLISECOND_FORMAT:String = msThe 'millisecond' string representation to format the unit amount time value.
| MINUTE | Constant |
public static const MINUTE:Number = 60000.0Factor from ms to minute.
| MINUTE_FORMAT | Constant |
public static const MINUTE_FORMAT:String = mThe 'minute' string representation to format the unit amount time value.
| SECOND | Constant |
public static const SECOND:Number = 1000Factor from ms to second.
| SECOND_FORMAT | Constant |
public static const SECOND_FORMAT:String = sThe 'second' string representation to format the unit amount time value.