Lasso Soft Inc. > Home

[ Date->ExtendedYear ]

Method

[Date->ExtendedYear] is an accessor for getting or setting the year of the current calendar system, encompassing all supra-year fields, for a date object. For example, in Gregorian/Julian calendars, positive Extended Year values indicate years AD, 1 BC = 0 extended, 2 BC = -1 extended, and so on.

Getting uses no parameters and returns the local day of week as an integer in the range of 1-7 inclusive.

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

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

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

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

Code

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

Result

2011
2005-02-21 08:00:00
2006-02-21 08:00:00
2005-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