LassoScript Utility
Basics Browse Detail

[Date_Difference]

Tag Link [Date_Difference] Category Date
Type Substitution Source Available No
Support Preferred Version 3.0
Change Unchanged Data Source Any
Output Type Duration, Integer 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_Difference] calculates the difference between two dates and returns the results in either seconds, minutes, hours, days, or weeks between the two dates.

The first two parameters can be either Lasso date data types or valid Lasso date strings. The second parameter is subtracted from the first parameter and the result is returned as an integer in specified units: -Second, -Minute, -Hour, -Day, -Week. Lasso rounds to the nearest integer when using these optional parameters.

Syntax

[Date_Difference: 'Base Date', 'Second Date', -Second]

[Date_Difference: 'Base Date', 'Second Date', -Minute]

[Date_Difference: 'Base Date', 'Second Date', -Hour]

[Date_Difference: 'Base Date', 'Second Date', -Day]

[Date_Difference: 'Base Date', 'Second Date', -Week]

Parameters

Required Parameters
Base Date The starting date from which the difference is calculated.
Second Date The ending date from which the difference is calculated.
Optional Parameters
Result Type The units of the result.

Examples

To calculate the difference between two dates:

Use the [Date_Difference] tag to calculate the difference between two dates. The following example returns the difference between two dates in several different formats.

<br>[Date_Difference: '12/26/2001', '12/25/2001', -Week]
<br>[Date_Difference: '12/26/2001', '12/25/2001', -Day]
<br>[Date_Difference: '12/26/2001', '12/25/2001', -Hour]
<br>[Date_Difference: '12/26/2001', '12/25/2001', -Minute]
<br>[Date_Difference: '12/26/2001', '12/25/2001', -Second]

<br>0
<br>1
<br>24
<br>1440
<br>86400