User Manual

GETTING STARTED


OTHER EDITIONS


LAUNCHERS


MODULES


PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support

ALL USER MANUAL VERSIONS

Ignition 8.1. Offline Version (04/2021)
Ignition 8 Online Version
Ignition 7.9 Online Version
Ignition 7.8 Online Version

Deprecated Pages

SDK Documentation

Employees

Sign In

Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

Returns the given date as a string and formatted according to a pattern. The pattern is a format that is full of various placeholders that display different parts of the date. These are case-sensitive. These placeholders can be repeated for a different effect. For example, M will give you 1-12, MM will give you 01-12, MMM will give you Jan-Dec, MMMM will give you January-December.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.date.format(date, format)

  • Parameters

Date date The date to format.

String format - A format string such as "yyyy-MM-dd HH:mm:ss". The format argument is optional. The default is "yyyy-MM-dd HH:mm:ss". Refer to Data Type Formatting Reference for a table of acceptable symbols. 

  • Returns

String - A string representing the formatted datetime.

  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
Code Snippet
# This example would format the current date to look like "01/01/01"
 
today = system.date.now()
print system.date.format(today, "yy/MM/dd") 
#This printed 16/04/01
Code Snippet
# This example would format the current date to look like "2001-01-31 16:59:59"
# This is a standard format that all databases recognize.
 
today = system.date.now()
print system.date.format(today, "yyyy-MM-dd HH:mm:ss")
Keywords

system date format, date.format