Lasso Soft Inc. > Home

[ date->subtract ]

Method

[Date->Subtract] subtracts a duration from a Lasso date object. This method modifies the date object in-place but does not output a value.

The first parameter is a Lasso date data type that has been cast using the [Date] method. The second parameter is a valid Lasso duration data type that either has been cast using the [Duration] method or is an integer or decimal representing the number of seconds to subtract from the first parameter.

Optional parameters may be used in place of a duration to define what should be subtracted from the first parameter: -Millisecond, -Second, -Minute, -Hour, -Day, -Week, -Month, or -Year.

  • Syntax
Date Object->subtract(Duration)
Date Object->subtract(Integer Seconds)
Date Object->subtract(Decimal Seconds)
Date Object->subtract(-year=Integer)
Date Object->subtract(-month=Integer)
Date Object->subtract(-week=Integer)
Date Object->subtract(-day=Integer)
Date Object->subtract(-hour=Integer)
Date Object->subtract(-minute=Integer)
Date Object->subtract(-second=Integer)
Date Object->subtract(-millisecond=Integer)
Examples
  • Beginner

To subtract a duration from a specified date:

Use the [Date->Subtract] method. The following example shows the result of subtracting a duration from a date using optional keywords.

Code

local(d) = date('2011-02-21 00:00:00')
#d->subtract(-year=1, -week=1, -day=1, -hour=1, -minute=1, -second=1)
#d

Result

2010-02-12 22:58:59

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft