Alma Analytics
Date-Time Functions in a Nutshell
Required knowledge: Basic Analytics.
Contents:
Introduction:
Time Extraction Functions:
| Function | Note |
|---|---|
SECOND (Time expr) |
Returns the number (between 0 and 59) corresponding to the seconds for a specified time expression. |
MINUTE(Time expr) |
Returns the number (between 0 and 59) corresponding to the seconds for a specified time expression. |
HOUR(Time expr) |
Returns a number (between 0 and 23) corresponding to the hour for a specified time expression. For example, 0 corresponds to 12 a.m. and 23 corresponds to 11 p.m. |
CURRENT_TIME(Time expr) |
Returns the current time. The time is determined by the system in which the Oracle Analytics Server is running. |
Example: Extract the hour from the current time
HOUR (CURRENT_TIME)
Date Extraction Functions:
Day
| Function | Note |
|---|---|
DAY (Time expr) |
Returns the number corresponding to the day of the month for a specified date expression. DayOfMonth also works. |
DayOfWeek(Time expr) |
Returns a number between 1 and 7 corresponding to the day of the week for a specified date expression. For example, 1 always corresponds to Sunday, 2 corresponds to Monday, and so on through to Saturday which returns 7. |
DAYNNAME(Time expr) |
Returns the name of the day of the week for a specified date expression. |
DayOfYear(Time expr) |
Returns the number (between 1 and 366) corresponding to the day of the year for a specified date expression. Day_of_Year() also works. |
DAY_OF_QUARTER(Time expr) |
Returns a number (between 1 and 92) corresponding to the day of the quarter for the specified date expression. |
CURRENT_DATE |
Returns the current date. The date is determined by the system in which the Oracle Analytics Server is running. |
Daytime:
| Function | Note |
|---|---|
NOW() |
Returns the current date/timestamp. The timestamp is determined by the system in which the Oracle Analytics is running. Time expr is any integer representing the number of digits of precision with which to display the fractional second. The argument is optional; the function returns the default precision when no argument is specified. CURRENT_TIMESTAMP also works. |
| Function | Note |
|---|---|
WEEK_OF_QUARTER (Time expr) |
Returns a number (between 1 and 13) corresponding to the week of the quarter for the specified date expression. |
WEEK_OF_YEAR(Time expr) |
Returns a number (between 1 and 53) corresponding to the week of the year for the specified date expression. |
| Function | Note |
|---|---|
MONTH (Time expr) |
Returns the number (between 1 and 12) corresponding to the month for a specified date expression. |
MONTHNAME(Time expr) |
Returns the name of the month for a specified date expression. |
MONTH_Of_QUARTER(Time expr) |
Returns the number (between 1 and 3) corresponding to the month in the quarter for a specified date expression. |
| Function | Note |
|---|---|
QUARTER (Time expr) |
Returns the number (between 1 and 4) corresponding to the quarter of the year for a specified date expression. |
| Function | Note |
|---|---|
YEAR (Time expr) |
Returns the year for the specified date expression. |
Calculate Date-Time Functions:
You can use datetime functions to calculate datetime values for columns, filters, or dashboard prompts. There are two functions allow you to calculate datetime values:
Add Time Functions to Prompts
Sometimes you need to dynamically set a default date value in your date prompt. For example, you may need to set a prompt value to one week earlier to current date or set a default date to a month earlier to the most recent loan date in your database.
Add Time Functions to Filters
To add a time function to a filter,
