Expression: Date Time Functions
DateTime functions are provided to manipulate FastStats date/time fields.
TimeHour
|
TimeHour( DateTime ). Calculates the hour of day of a DateTime
TimeHour([Communication Date])
e.g. 17-06-2010 16:43:24 returns 16
|
TimeMinute |
TimeMinute( DateTime ). Calculates the minute of hour of a DateTime
TimeMinute([Communication Date])
e.g. 17-06-2010 16:43:24 returns 43
|
TimeSecond |
TimeSecond( DateTime ). Calculates the second of minute of a DateTime
TimeSecond([Communication Date])
e.g. 17-06-2010 16:43:24 returns 24
|
TimeDiff
|
TimeDiff calculates the difference between 2 DateTimes, measured in the specified units. If no units are specified, seconds are used.
TimeDiff([DateTime1],[DateTime2],"Hours")
If only 1 DateTime is specified, it will compare to the current date and time:
|
MakeDateTime
|
MakeDateTime creates a DateTime from constituent parts
MakeDateTime(Year,Month,Day,Hour,Minute,Second)
e.g. 17-06-2010 16:43:24
|
SelectedHours
|
SelectedHours calculates the number of hours between two date time values
SelectedHours(datetime1,datetime2,day_pattern,starttime,endtime)
Example:
In the above example the first date-time is a variable and the second is constructed using the MakeDateTime function. The day pattern is made up of 1 and 0 to represent which days of the week to consider (Monday to Sunday). The start and end times indicate the hours within a day to consider. Therefore in this example we are only considering the hours in a working week, Monday to Friday between 8.30am to 5.30pm (24 hour time display).
|
TimeNow |
TimeNow returns the current DateTime shifted by a specified number of seconds
TimeNow(300)
The above example will return the date for today and the time 300 seconds in advance of the current time when the request to process is started. e.g. If the date and time were 16/05/2018 11:10:25, the result returned would be 16/05/2018 11:15:25.
|
FormatTime |
FormatTime takes the numeric value in the parameter and formats it as an elapsed time string in seconds
FormatTime(230)
The above example will return 3 minutes and 50 seconds (230 seconds) as 00:03:50
|
DateTimeToNumber |
DateTimeToNumber(DateTime)
Converts the date time to a number in the form YYYYMMDDHHMMSS.
e.g. DateTimeToNumber([Order DateTime]) - returns the order datetime as a numeric.
|