Onetastic Macro Documentation >
>
>
TimeSpan TimeSpan
Returns a time span value that can be added or subtracted from a date/time object using DateTime_Add and DateTime_Subtract functions.
Syntax
TimeSpan TimeSpan(
Integer amount,
String unit)
Parameters
- Integer amount
- Amount of time, based on the unit.
- String unit
- Unit for the timespan. Can be one of sec, min, hour, or day.
Examples
$now = DateTime_Now()
$fourDaysLater = DateTime_Add($now, TimeSpan(4, "day"))
$threeHoursEarlier = DateTime_Subtract($now, TimeSpan(3, "hour"))
$threeHoursEarlier = DateTime_Add($now, TimeSpan(-3, "hour"))
|