Link | date_firstdayofweek |
Author | Jason Huck |
Category | Date |
Version | 8.x |
License | Public Domain |
Posted | 20 Jul 2006 |
Updated | 02 Aug 2007 |
More by this author... |
Returns the date of the first day of the week for the given date. If no date is provided, it uses today's date. Optionally accepts a -starton parameter to indicate whether the week should start on Sunday (1) or Monday (2).
date_firstdayofweek; date_firstdayofweek( -date=date('7/20/2006'), -starton=2);
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_tag( 'firstdayofweek', -namespace='date_', -opt='date', -type='date', -copy, -opt='starton', -type='integer', -priority='replace', -description='Returns the date of the first day of the week for the given date.' ); !local_defined('date') ? local('date') = date; #date->set( -hour=14, -minute=0, -second=0); !local_defined('starton') ? local('starton') = 1; (: 1, 2) !>> #starton ? #starton = 1; local('daynum') = integer(#date->format('%w')); if(#daynum == #starton); return(#date); else(#daynum < #starton); return(#date->add( -day=1)&); else; return(#date->subtract( -day=(#daynum - #starton))&); /if; /define_tag;
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Update