Link | duration2 |
Author | Jason Huck |
Category | Data Type |
Version | 8.x |
License | Public Domain |
Posted | 12 Jun 2006 |
Updated | 09 May 2008 |
More by this author... |
This is an alternate version of the built-in [duration] type (actually a subclass of it) whose member tags never round up -- they return the whole number of units of each type. Uses the plural form of each unit, i.e., ->seconds, ->minutes, ->hours, ->days, ->weeks, ->months, ->years. Otherwise identical to [duration].
duration2('00:30:01')->hours; -> 0
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_type( 'duration2', 'duration', -description='Alternate version of [duration] that never rounds up.' ); define_tag('seconds'); return(self->second); /define_tag; define_tag('minutes'); return(math_floor(self->second / 60)); /define_tag; define_tag('hours'); return(math_floor(self->second / 3600)); /define_tag; define_tag('days'); return(math_floor(self->second / 86400)); /define_tag; define_tag('weeks'); return(math_floor(self->second / 604800)); /define_tag; define_tag('months'); return(math_floor(self->days / 30.4375)); /define_tag; define_tag('years'); return(math_floor(self->days / 365.25)); /define_tag; /define_type;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft