Date/Time Functions

String GetTime(DateTime date)
Returns the time portion string for the given date.

DateTime SetTime(DateTime date, String time)
Sets the time portion of the given date.

DateTime SetDayOfMonth(DateTime date, Number day)
Sets the day of the month for the given date.

DateTime SetMonth(DateTime date, Number month)
Sets the month portion of the given date.

DateTime AddDays(DateTime dateTime, Number days)
Adds the given number of days to the given date, and returns a new date.

DateTime AddMonths(DateTime dateTime, Number months)
Adds the given number of months to the given date, and returns a new date.

DateTime AddMinutes(DateTime dateTime, Number mins)
Adds the given number of minutes to the given date, and returns a new date.

DateTime AddSeconds(DateTime dateTime, Number secs)
Adds the given number of seconds to the given date, and returns a new date.

DateTime Today()
Returns today's date, without a time portion.

DateTime UtcNow()
Returns the current UTC time.

DateTime DateOnly(DateTime date)
Returns the date-only portion of a date time value.

Boolean IsHoliday(String selectedHolidaySchedule, DateTime date, Boolean includeWeekends)
Returns true if the given date lies on a holiday, using the given holiday schedule link value. Optionally include weekends in this determination.

DateTime MaxDate()
Returns the maximum date that the system can hold.

DateTime MinDate()
Returns the minimum date that the system can hold.

DateTime NullDate()
Returns an empty date field. This should be used in predicates when checking for unset dates, eg. load(&path[Date=NullDate()])

Number Year(Any expr)
Returns the year portion of the given date value.

Number Month(Any expr)
Returns the month portion of the given date value.

Number Day(Any expr)
Returns the day of the month portion of the given date value.

Number DayOfWeekAsNumber(Any expr)
Returns the day of the week portion of the given date value.

Number DaysBetween(Any odate1, Any odate2)
Return the days between the two dates.

Number MonthsBetween(Any odate1, Any odate2)
Returns the months between the two dates.

Number SecondsBetween(Any odate1, Any odate2)
Returns the seconds between the two dates.

Number TicksBetween(Any odate1, Any odate2)
Returns the milliseconds between the two dates.

Number Hour(Any odate1)
Returns the hour portion of the given date.

Boolean ValidateTime(String time)
Validates that the given time string is a valid time.

String FormatHours(Any expr, String format)
Formats the given date value for display as hours. Currently the only format supported is "c", which returns for example "1d 1h 1m".

String FormatDate(Any expr, String format)
Formats the given date using the given standard date format string.

DateTime Date(Any expr)
Returns the date value of a given string value.

DateTime DateAndTime(Any expr)
Returns the date and time value of a given string value.

String DateStr(Any expr)
Converts the given date value into a string, using the default formatting.

DateTime Now()
Returns the current date and time.

Number WorkHoursBetween(DateTime start, DateTime end)
Calculates the work hours between the two date/time values, presuming Saturday and Sunday as non-working days.

Number WorkHoursBetweenEx(DateTime start, DateTime end, String timeStart, String timeEnd, String daysAlwaysOff, Record otherDaysOff, Number maxOut)
Returns the number of work hours between the given start date and timeStart (leave as empty for midnight) and end date / timeEnd (leave empty for midnight). The daysAlwaysOff is a list of digits that correspond to day of the week (0=sunday, 6=saturday) that will always be considered a workday. The record otherDaysOff can be created with NewRecord() and is a list of date days that will also be considered work holidays. The maxOut can be set to stop it from over-processing, and should be set to a high number like 1,000.


Next Topic:
v4.2.0.956 (beta)
Up Since 2/29/2024 12:02:23 AM