Lasso Soft Inc. > Home

[ date->dayOfWeekInMonth ]

Method

[Date->DayOfWeekInMonth] is an accessor for getting or setting the day of week in month field for a date object. For example the 8th through 14th days of the month are in the second week of the month, so 2 would be the value.

Getting uses no parameters and returns the day of week in month as an integer.

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->dayofweekinmonth
Date Object->dayofweekinmonth=Integer
Date Object->dayofweekinmonth+=Integer
Date Object->dayofweekinmonth-=Integer
Examples
  • Beginner

To get or set the day of week in month field of a date object:

Use the [Date->DayOfWeekInMonth] method. The following example uses a single date object, then gets the day of week in month and returns its value.

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

Code

local('d') = date('2011-02-01')
#d->dayofweekinmonth + '<br>'
#d->dayofweekinmonth=2
#d + '<br>'
#d->dayofweekinmonth+=1
#d + '<br>'
#d->dayofweekinmonth-=1
#d

Result

1
2011-02-08 00:00:00
2011-02-15 00:00:00
2011-02-08 00:00:00

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