LassoScript Utility
Basics Browse Detail

[Date_Subtract]

Tag Link [Date_Subtract] Category Date
Type Substitution Source Available No
Support Preferred Version 3.0
Change Unchanged Data Source Any
Output Type Date Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x

Description

[Date_Subtract] subtracts a specified number of weeks, days, hours, minutes, or seconds from a base date value. The first parameter should be a Lasso date data type or valid Lasso date string. Subsequent keyword/value parameters define what should be subtracted from the first parameter: -Second, -Minute, -Hour, -Day, -Week, -Month, or -Year.

Syntax

[Date_Subtract: (Date),
-Year=Integer,
-Month=Integer,
-Week=Integer,
-Day=Integer,
-Hour=Integer,
-Minute=Integer,
-Second=Integer]

[Date_Subtract: 'mm/dd/yyyy',
-Year=Integer,
-Month=Integer,
-Week=Integer,
-Day=Integer,
-Hour=Integer,
-Minute=Integer,
-Second=Integer]

Parameters

Required Parameters
Base Date The date data type or valid date string to be operated upon.
Optional Parameters
-Second The number of seconds to subtract from the date.
-Minute The number of minutes to subtract from the date.
-Hour The number of hours to subtract from the date.
-Day The number of days to subtract from the date.
-Week The number of weeks to subtract from the date.
-Month Specifies the number of calendar months to subtract from the date.
-Year Specifies the number of calendar years to subtract from the date.

Change Notes

The -Month and -Year parameters were added in Lasso 7.

Examples

To return the date of the same day a week ago:

Use the [Date_Subtract] tag to subtract one week from the current date. The following example outputs the date and time of the moment which is exactly seven days in the past.

<p>[Date_Subtract: (Date), -Week=1]

<p>9/6/2001 13:43:24