Time 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.
There are two ways to access the Time instance:
The first way is by in*()( inHours(), inMinutes(),...).
Those methods are coversions to the different time units. You can recieve the
complete value in a different unit.
Example:
var time:Time = new Time(1.5, "d");
trace(time.inDays()); // 1.5
trace(time.inHours()); // 36
trace(time.inMinutes()); // 2160
The second way is by get*()( getHours(), getMinutes(),...).
Those methods contain only the part of each unit that is contained within the
value.
Example:
var time:Time = new Time(1.5, "d");
trace(time.getDays()); // 1.5
trace(time.getHours()); // 12
trace(time.getMinutes(); // 0
Its possible to pass-in a number in to round the value to the next lower case:
Example:
var time:Time = new Time(1.5, "d");
trace(time.getDays(0)); // 1
new Time()public function setValue(timeDifference:Number, format:String):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.
format | (optional) "d"/"h"/"m"/"s"/"ms" for the unit of the amout. Default value is ms. |
public function plus(timeDifference:Time):Time
Adds the passed-in timedistance to the current time.
timeDifference | time difference to be added to the current time |
new instance with the resulting amount of time
public function minus(timeDifference:Time):Time
Adds the passed-in timeDifference from the current time.
timeDifference | time difference to be removed from the current time |
new instance with the resulting amount of time
public function getMilliSeconds(round:Number):NumberGetter for the amount of milliseconds are contained within the time.
It will not round the result if you pass-in nothing.
round | (optional) the number of decimal spaces |
time difference in milliseconds
public function inMilliSeconds(Void):NumberGetter for the time distance in milliseconds.
time difference in milliseconds
public function getSeconds(round:Number):NumberGetter for the amount of seconds are contained within the time.
It will not round the result if you pass-in nothing.
round | (optional) the number of decimal spaces |
time difference in seconds
public function inSeconds(Void):NumberGetter for the time distance in seconds.
time difference in seconds
public function getMinutes(round:Number):NumberGetter for the amount of minutes are contained within the time.
It will not round the result if you pass-in nothing.
round | (optional) the number of decimal spaces |
time difference in minutes
public function inMinutes(Void):NumberGetter for the time distance in minutes.
time difference in minutes
public function getHours(round:Number):NumberGetter for the amount of hours are contained within the time.
It will not round the result if you pass-in nothing.
round | (optional) the number of decimal spaces |
time difference in hours
public function inHours(Void):NumberGetter for the time distance in hours.
time difference in hours
public function getDays(round:Number):NumberGetter for the amount of days are contained within the time.
It will not round the result if you pass-in nothing.
round | (optional) the number of decimal spaces |
time difference in days
public function inDays(Void):NumberGetter for the time distance in days.
time difference in days
public function toString():StringGenerates String representation of the time.
time difference as string
toString() in org.as2lib.core.BasicInterface