Skip to main content
Version: 7.9

system.date.parse

New in 7.9.1

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

TypeParameterDescription
StringdateStringThe string to parse into a date.
StringformatStringFormat string used by the parser. Default is "yyyy-MM-dd HH:mm:ss" [optional]
ObjectlocaleLocale used for parsing. Can be the locale name such as 'fr', or the Java Locale such as 'Locale.French'. Default is 'Locale.English'. Click here for a list of supported locales and and values. [optional]

Returns

Date - The parsed date.

Scope

All

Code Examples

Example #1
# 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')
Example #2
# 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")

# 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)