Skip to main content
Version: 7.9

system.date.get*

This function is used in Python Scripting.

Description

This function is a set of functions that include:

FunctionDescription
system.date.getMillisExtracts the milliseconds from a date, ranging from 0-999.
system.date.getSecondExtracts the second from a date, ranging from 0-59.
system.date.getHour12Extracts the hour from a date. Uses a 12 hour clock, so noon and midnight are returned as 0.
system.date.getHour24Extracts the hour from a date. Uses a 24 hour clock, so midnight is zero.
system.date.getDayOfWeekExtracts the day of the week from a date. Sunday is day 1, Saturday is day 7.
system.date.getDayOfMonthExtracts the day of the month from a date. The first day of the month is day 1.
system.date.getDayOfYearExtracts the day of the year from a date. The first day of the year is day 1.
system.date.getMonthExtracts the month from a date, where January is month 0.
system.date.getQuarterExtracts the quarter from a date, ranging from 1-4.
system.date.getYearExtracts the year from a date.
system.date.getAMorPMReturns 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

TypeParameterDescription
DatedateThe date to use.

Returns

Int - An integer that is representative of the extracted value.

Scope

All

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)