system.date.get*
This function is used in Python Scripting.
Description​
This function is a set of functions that include:
Function | Description |
---|---|
system.date.getMillis | Extracts the milliseconds from a date, ranging from 0-999. |
system.date.getSecond | Extracts the second from a date, ranging from 0-59. |
system.date.getMinute | Extracts the minutes from a date, ranging from 0-59. |
system.date.getHour12 | Extracts the hour from a date. Uses a 12 hour clock, so noon and midnight are returned as 0. |
system.date.getHour24 | Extracts the hour from a date. Uses a 24 hour clock, so midnight is zero. |
system.date.getDayOfWeek | Extracts the day of the week from a date. Sunday is day 1, Saturday is day 7. |
system.date.getDayOfMonth | Extracts the day of the month from a date. The first day of the month is day 1. |
system.date.getDayOfYear | Extracts the day of the year from a date. The first day of the year is day 1. |
system.date.getMonth | Extracts the month from a date, where January is month 0. |
system.date.getQuarter | Extracts the quarter from a date, ranging from 1-4. |
system.date.getYear | Extracts the year from a date. |
system.date.getAMorPM | Returns a 0 if the time is before noon, and a 1 if the time is after noon. |
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.date.get*(date)
Parameters​
Type | Parameter | Description |
---|---|---|
Date | date | The date to use. |
Returns​
Integer - An integer that is representative of the extracted value.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Example #1
# This example would grab the current time, and print the current month.
date = system.date.now()
print system.date.getMonth(date) #This would print the current month.
Example #2
# This example would create a date object, and print out the quarter of that date.
date = system.date.getDate(2017, 3, 15) #This would print "Mon April 15 00:00:00 PDT 2016"
print system.date.getQuarter(date) #This will print 2
Example #3
# This example can be placed on the action performed event of a button.
# It will then grab the day of the week of the calendar component,
# and enter the value returned into a numeric text field.
date = event.source.parent.getComponent('Calendar').date
event.source.parent.getComponent('Numeric Text Field').intValue = system.date.getDayOfWeek(date)
Keywords​
system date get, date.get, date getMillis, date.getMillis, date getSecond, date.getSecond, date getMinute, date.getMinute, date getHour12, date.getHour12, date getHour24, date.getHour24,date getDayOfWeek, date.getDayOfWeek, date getDayOfMonth, date.getDayOfMonth, date getDayOfYear, date.getDayOfYear, date getMonth, date.getMonth, date getQuarter, date.getQuarter, date getYear, date.getYear, date getAMorPM, date.getAMorPM