© Copyright 2023, Astera Software
Example
In this example, we will pass a string value representing an unknown date format to the function transformation object using a Variables object.
Where,
str = 1978.MAR.17
In the output window, you can see that the provided value has been parsed successfully, the unknown date format has been converted into a known date format, and the Boolean value, True has been returned, indicating a successful parameter test.
Name
TryParseDate
Syntax
TryParseDate (String str, Unknown date)
Purpose
To carry out a parameter test which checks whether a string value can be converted into a DateTime format value.
Description
Returns true if a string value is successfully converted and parsed into a DateTime value. Otherwise returns false.
Return Type
Boolean
Parameters
Str [System.String] – Value to be tested
Date [System.DateTime]