Lasso Soft Inc. > Home

[ Duration ]

Method

[Duration] casts values as a duration data type, which represents a length of time in hours, minutes, and seconds. The [Duration] method takes several forms.

The first form accepts a start date parameter and an end date parameter, and returns the duration between the two dates.

The second form accepts a start date string parameter and an end date string parameter, and returns the duration between the two dates.

The third form accepts a single integer parameter as the number of seconds, and returns the duration.

The fourth form accepts -Year, -Week, -Day, -Hour, -Minute, and -Second parameters for the specified number of years, weeks, days, hours, minutes, and seconds, and returns the duration.

The fifth form accepts a time string in the form of hh:mm:ss, and returns the duration.

  • Syntax
  • Methods
  • Traits
duration(Start Date Object, End Date Object)
duration('Start Date String','End Date String')
duration(Integer Seconds)
duration(-year=Integer, -week=Integer, -day=Integer, -hour=Integer, -minute=Integer, -second=Integer)
duration('Time String')
Has methods:
Has traits:
Examples
  • Beginner

To cast objects to a duration data type:

Use the [Duration] method. The following examples illustrate casting an object to a duration data type in all its forms.

Code

duration(date('2011-02-19'),date('2011-02-20'))
duration('2011-02-19','2011-02-20')
duration(600)
duration(-year=1, -week=1, -day=1, -hour=1, -minute=1, -second=1)
duration('16:33:48')

Result

24:00:00
24:00:00
00:10:00
8953:01:01
16:33: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