Lasso Soft Inc. > Home

[ date->yearWOY ]

Method

[Date->YearWOY] is an accessor for getting or setting the yearwoy field for a date object. The value of the yearwoy field is a number indicating the extended year corresponding to the UCAL_WEEK_OF_YEAR field. This may be one greater or less than the value of UCAL_EXTENDED_YEAR.

Getting uses no parameters and returns the yearwoy within the current month as an integer. The first week of the month has value 1.

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

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

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

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

Code

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

Result

2011
2011-02-21 08:00:00
2012-02-20 08:00:00
2011-02-21 08: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 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft