Link | jina_weekNum |
Author | Jolle Carlestam |
Category | Date |
Version | 8.x |
License | Public Domain |
Posted | 05 Feb 2008 |
Updated | 05 Feb 2008 |
More by this author... |
Returns the fiscal week number (ISO) of a given date, datevalue needs to be a valid Lasso date. First day of week is presumed to be Monday. The tag return the correct ISO week number contrary to Lasso own date -> week as of version 8.X.
jina_weekNum(date);
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.
type != 'date'; #date = (date: #date, -format='%Y-%m-%d'); /if; if:#date -> type != 'date'; Fail: 8020, 'Submitted date not of date type'; /if; Local:'theDate' = (local:'date') + (Duration:7200); Local:'theYear' = (#theDate->Year); Local:'firstDateofYear' = (Date:-Month = 1, -Day = 1, -Year = #theYear, -Time = '04:00:00'); Local:'firstDayofYear' = (#firstDateofYear->DayOfWeek); if:(#firstDayofYear <= 5) && (#firstDayofYear != 1); Local:'startDate'= (Date_Subtract:(#firstDateofYear), -Day = (#firstDayofYear - 2)); else: (#firstDayofYear == 1); Local:'startDate' = (Date_Add:(#firstDateofYear), -Day = (1)); else; Local:'startDate' = (Date_Add:(#firstDateofYear), -Day = (9 - #firstDayofYear)); /if; Local:'DayinWeek' = (#theDate->DayOfWeek); if:(#DayinWeek != 1); Local:'firstDateinWeek' = (Date_Subtract:(#theDate), -Day = (#DayinWeek - 2)); else; Local:'firstDateinWeek' = (Date_Subtract:(#theDate), -Day = 6); /if; Local:'theWeeksBetween' = (Date_Difference:#firstDateinWeek, #startDate, -Week) + 1; if:#theWeeksBetween == 0; #theWeeksBetween = jina_weekNum:(Date_Subtract:(#theDate), -Day = 1); /if; if:(#theWeeksBetween == 53) && ((date:#firstDateinWeek) >= (Date:-Month = 12, -Day = 29, -Year = #theYear, -Time = '04:00:00')); #theWeeksBetween = 1; /if; Return: #theWeeksBetween; /Define_Tag; ?>
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft