Date and time functions are used with date and time variables to express the current date and time (at the start of the session), to set the date and time, to calculate the difference in units between two dates, to extract a unit from a date and time, to extract a time of day, and to get an earliest/latest date and time.
Be sure to use the exact syntax for these functions including spacing and parentheses as specified below.
TIP: The localized syntax for these functions may be viewed:
Function | Example rule | Inputs |
Outputs |
---|---|---|---|
CurrentDateTime |
|
the current date time: 2009-09-15 03:24:12 | the date and time of the investigation = 2009-09-15 03:24:12 |
DateTime |
|
the submission date and time specified on the application form: 2012-12-31 18:00:00 | the latest submission date and time= 2012-12-31 18:00:00 |
ConcatenateDateTime |
|
the submission date: 2010-01-15 the submission closing time: 17:00:00 |
the latest submission time = 2010-01-15 17:00:00 |
SecondDifference |
|
the first place time: 2008-06-30 09:31:05 the second place time: 2008-06-30 09:31:10 |
the number of seconds between first place and second place = 5 |
MinuteDifference |
|
the time the plumber was meant to arrive: 2009-10-18 08:30:00 the time that the plumber actually arrived: 2009-10-18 09:00:40 |
the number of minutes late the plumber is = 30 |
HourDifference |
|
the scheduled arrival time of the flight: 2006-10-13 09:50:00 the arrival time of the delayed flight: 2006-10-13 11:00:00 |
the number of hours the plane was delayed by = 1 |
DayDifference |
|
date time1: 2006-10-01 12:00:00 date time2: 2006-10-14 12:00:00 |
the number of days in the assessment period = 13 |
DayDifferenceInclusive |
|
date time1: 2006-10-01 12:00:00 date time2: 2006-10-14 12:00:00 |
the number of days in the assessment period = 14 |
DayDifferenceExclusive |
|
date time1: 2006-10-01 12:00:00 date time2: 2006-10-14 12:00:00 |
the number of days in the assessment period = 12 |
WeekDifference |
|
the current date time: 2006-07-19 16:30:00 the expiry date time: 2006-08-22 17:00:00 |
the number of weeks remaining = 4 |
MonthDifference |
|
the current date time: 2006-07-19 16:30:00 the expiry date time: 2006-12-25 17:00:00 |
the number of months remaining = 5 |
YearDifference |
|
the date time that the tree was planted: 2000-03-12 10:40:00 the date time that the tree was assessed: 2003-12-12 12:05:00 |
the age of the tree in years = 3 |
ExtractSecond |
|
the submission time: 2004-02-21 14:42:32 | the second component of the submission time = 32 |
ExtractMinute |
|
the submission time: 2004-02-21 14:42:32 | the minute component of the submission time = 42 |
ExtractHour |
|
the submission time: 2004-02-21 14:42:32 | the hour component of the submission time = 14 |
ExtractDay |
|
the password expiry date time: 2009-09-11 00:00:00 | the password expiry day = 11 |
ExtractMonth |
|
the password expiry date time: 2009-09-11 00:00:00 | the password expiry month = 09 |
ExtractYear |
|
the password expiry date time: 2009-09-11 00:00:00 | the password expiry year = 2009 |
ExtractTimeOfDay |
|
the current date time: 2009-09-04 10:46:12 | the time of the assessment = 10:46:12 |
Latest (uses the Maximum function) |
|
date time1: 2011-03-06 17:30:00 date time2: 2012-03-06 17:30:00 |
the last time to enrol = 2012-03-06 17:30:00 |
Earliest (uses the Minimum function) |
|
date time 1: 2009-12-31 23:59:59 the book in time allocated to the group: 2010-01-02 00:00:00 |
the earliest time to book in = 2009-12-31 23:59:59 |
See also: