Lasso Soft Inc. > Home

[ date->second ]

Method

[Date->Second] is an accessor for getting or setting the second field for a date object.

Getting uses no parameters and returns the second value as an integer from 0 to 59.

Setting requires an integer parameter, and supports the =, += and -= operators. Setting modifies the date object in-place, but does not return a value.

  • Syntax
Date Object->second
Date Object->second=Integer
Date Object->second+=Integer
Date Object->second-=Integer
Examples
  • Beginner

To get or set the second field of a date object:

Use the [Date->Second] method. The following example uses a single date object, then gets the second and returns its value.

Next we set the second field to a new value using the = operator, then set it again by adding 1 to the second using the += operator, and set it once more by subtracting 1 from the second using the -= operator. We return the result for each set operation.

Code

local(d) = date('2011-02-21 08:00:12')
#d->second + '<br>'
#d->second=5
#d->second + '<br>'
#d->second+=1
#d->second + '<br>'
#d->second-=1
#d->second

Result

12
2011-02-21 08:00:05
2011-02-21 08:00:06
2011-02-21 08:00:05

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 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft