You're currently browsing the Ignition 8.0 docs. Click here to view the latest docs.

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.getMinuteExtracts the minutes 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

Date  date The date to use.

  • Returns

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

  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
Code Snippet
# 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.
Code Snippet
# 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
Code Snippet
# 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

  • No labels