Lesson Summary
You now know that date values in the KnowledgeKube Expression Engine must be written as strings contained within double quotes. Date strings consist of a day part then a month part, then a year part (in that order), with each part separated by either a forward slash or a full stop.
"05/11/12" is an example of a valid date string
In addition to writing dates, you can now use the following built-in date functions to compare and modify date strings:
- GetDate - This function simply returns the current date. It requires no arguments.
- DateDiff - Given two dates as arguments, returns the difference between the two in hours. An optional third argument allows you to request the difference in days, minutes or seconds instead.
- DateAdd - Adds an amount to a specified date. The three arguments are: a string containing the unit type (for example “Day”), the number of that unit to be added, and a string representation of the date string being added to. To subtract from a given date, you would instead write the second argument as a negative number.
- DateCompare - Given two date strings, returns a value of -1 if the first date occurs before the second, 0 if the two dates are equal, and 1 if the first date occurs after the second.
<< Previous: Date Comparison (DateCompare) | Next: Test Your Knowledge! >>