Lasso Soft Inc. > Home

[ date_difference ]

Method

[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)
Examples
  • Beginner

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.

Code

[Date_Difference( '12/26/2001', '12/25/2001', -Week)]
[Date_Difference( '12/26/2001', '12/25/2001', -Day)]
[Date_Difference( '12/26/2001', '12/25/2001', -Hour)]
[Date_Difference( '12/26/2001', '12/25/2001', -Minute)]
[Date_Difference( '12/26/2001', '12/25/2001', -Second)]

Result

0
1
24
1440
86400

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