get*
This function is used by Ignition's Expression language.
Description
This function is a set of functions that include:
Function | Description |
---|---|
getMillis | Extracts the milliseconds from a date, ranging from 0-999. |
getSecond | Extracts the second from a date, ranging from 0-59. |
getMinute | Extracts the minutes from a date, ranging from 0-59. |
getHour12 | Extracts the hour from a date. Uses a 12 hour clock, so noon and midnight are returned as 0. |
getHour24 | Extracts the hour from a date. Uses a 24 hour clock, so midnight is zero. |
getDayOfWeek | Extracts the day of the week from a date. Sunday is day 1, Saturday is day 7. |
getDayOfMonth | Extracts the day of the month from a date. The first day of the month is day 1. |
getDayOfYear | Extracts the day of the year from a date. The first day of the year is day 1. |
getMonth | Extracts the month from a date, where January is month 0. |
getQuarter | Extracts the quarter from a date, ranging from 1-4. |
getYear | Extracts the year from a date. |
getAMorPM | Returns a 0 if the time is before noon, and a 1 if the time is equal to or after noon. |
Syntax
get*(date)
Parameters
- Date date - The date to extract from.
Results
- int - The value of the units of the date specified. The units are determined by the function used.
Code Examples
Code Snippet
getMonth(now()) #This would print the current month.
Code Snippet
getQuarter(getDate(2017, 3, 15)) //The date is in the second quarter
Code Snippet
getDayOfWeek({Root Container.Calendar.date}) //Will grab the day of the week of the selected date of the calendar component