Lasso Soft Inc. > Home

[ date->difference ]

Method

[Date->Difference] determines the duration time between two Lasso dates. Requires a date type as the parameter.

The difference between the two dates is calculated by subtracting the Lasso date object from the date parameter. The output is a Lasso duration in hh:mm:ss format.

Optional parameters may be used to ouput a specified integer time value instead of a duration: -Millisecond, -Second, -Minute, -Hour, -Day, -Week, -Month, -Year. Lasso rounds to the nearest integer when using these optional parameters.

  • Syntax
Date Object->difference(Date Parameter)
Date Object->difference(Date Parameter, -year)
Date Object->difference(Date Parameter, -month)
Date Object->difference(Date Parameter, -week)
Date Object->difference(Date Parameter, -day)
Date Object->difference(Date Parameter, -hour)
Date Object->difference(Date Parameter, -minute)
Date Object->difference(Date Parameter, -second)
Date Object->difference(Date Parameter, -millisecond)
Examples
  • Beginner

To determine the duration between two dates, or return a specified integer time value:

Use the [Date->Difference] method. The following examples show how to calculate the time difference between two dates. The first example returns a duration, and the second returns the difference as a number of hours.

Code

date('2011-02-21 08:00:00')->difference(date('2011-02-23 08:00:00'))
date('2011-02-21 08:00:00')->difference(date('2011-02-23 08:00:00'), -hour)

Result

48:00:00
48

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