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