system.date.parse
This function is used in Python Scripting.
Description​
Attempts to parse a string and create a Date. Causes ParseException if the date dateString parameter is in an unrecognized format.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.date.parse(dateString, [formatString], [locale])
Parameters​
Type | Parameter | Description |
---|---|---|
String | dateString | The string to parse into a date. |
String | formatString | Format string used by the parser. Default is "yyyy-MM-dd HH:mm:ss" Refer to Data Type Formatting Reference. [optional] |
Object | locale | Locale used for parsing. Can be the locale name such as 'fr', or the Java Locale such as 'Locale.French'. Default is 'Locale.English'. Refer to Java Locale. [optional] |
Returns​
Date - The parsed date.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Code Snippet
# This example will return a date object set to the given date and time, May 28th, 1992 at 4:22am.
print system.date.parse('May 28, 1992 4:22', 'MMMM dd, yyyy hh:mm')
Code Snippet - Using the Locale Parameter
# This example demonstrates the locale parameter to parse a French date
print system.date.parse("juillet 15, 2015 10:32:15", "MMMM dd, yyyy hh:mm:ss", "fr")
Code Snippet - Using the Java Locale
# This example demonstrates using the Java Locale. If using the Java Locale, then you must import from the Locale class. The following example parses a German date.
from java.util import Locale
print system.date.parse('21-Februar-2017 04:22:00', 'dd-MMMM-yyyy HH:mm:ss', Locale.GERMAN)