You can create arrays of any data type to store more than one value at the same time like this:
String[] s1;. For a given array, all items must be of the same type. Read more about looping and accessing array items in the fundamentals section.Constructors
Date Date(Date p0)
Pass aDate object to copy into a new object.
Date Date(String date)
Pass aString containing a date on format YYYY-MM-DD. The constructor will parse the text and create a Date object.
Dates as strings
String toString()
toString() is one of the most frequently used methods, typically when you are going to output something. It returns a string representation of a Date.
Setting and updating dates
Day, month, and year are set relative to when the Date object was created.- Dates in the future are specified as increments (a positive amount)
- Dates in the past are specified as decrements (a negative amount)
Date addDay(Integer num)
addDay() will adjust the currently set date with the given number of days.
The parameter granularity is days.
Date addMonth(Integer num)
addMonth() will adjust the currently set date with the given number of months.
The parameter granularity is months.
Date addYear(Integer num)
addYear() will adjust the currently set date with the given number of years.
The parameter granularity is years.
Retrieving properties of dates
You can retrieve the day, month, and year as well as the day of the week and the week number.Integer getMDay()
getMDay() returns the day of the month as an Integer [1-31].
Integer getMonth()
getMonth() returns the month as an Integer [1-12].
Integer getWeek()
getWeek() returns the number of the week as an Integer [1-53].
Integer getWeekDay()
getWeekDay() returns the day of the week as an Integer [0-6].
Integer getYear()
getYear() returns the year as an Integer.
No value
Before a Date is initialized, it has no value. This is commonly written as NULL, NUL, or NIL in other programming languages. CRMScript automatically initializes Date objects when declared to the current date. Thus this situation is uncommon. However, it is a good habit to always test that you have a value before using it.Bool isNull()
isNull() will return true if it has no value and false if it does.