Date operators

Tinderbox Icon

Version 4.0.0 added new Date accessors and manipulator operators are available for rules and actions.

date(year,month,day,hour,min)

constructs a date from individual numeric elements -- useful, for example, if you need to assemble a date from separate attributes. year is the 4-digit year, month is a number from 1-12. The time arguments are optional, and are specified in a 24-hour clock.

date("string")

constructs a date from a string or string expression. Usually, this is not necessary; Tinderbox will coerce the string to a date type automatically. In some contexts, though, it may be more convenient or more clear to make the conversion explicit. (See format to convert dates into strings).

day(theDate)

returns the day of the month from the theDate expression.

day(theDate,value)

creates a new date based on the theDate expression, but in which the day of the month is value. theDate is not changed.

month(theDate)

returns the month from the theDate expression.

month(theDate,value)

creates a new date based on the theDate expression, but in which the month is value. theDate is not changed.

time(theDate)

returns the time from the theDate expression.

time(theDate,hours,minutes)

creates a new date based on the theDate expression, but in which the time is set by hours and minutes. theDate is not changed.

days(date1,date2)

returns the number of days that elapsed between date1 and date2.

Examples:

date(2004,7,23,16,45) ...is 23 July 2004 4:45pm

If $Date is July 4, 2009 then

day($Date) ...is 4

If $Date is July 4,2009, then

$Date=day($Date,5)

will change $Date to July 5, 2009.

If $Date is July 4, 2009 then

month($Date) ...is 7

If $Date is July 4,2009, then

$Date=month($Date,5)

will change $Date to May 4, 2009.


Up: Actions & Rules
Previous: Color operators  Next: Set creation operators 

[Last updated: 3 Dec 2008]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox