toDate Method

Class: String

Description

This method converts a formatted date to a Julian date. This method replaces the $$^SCAJD() function.

Syntax

StringObject.toDate(String format)

Parameters

format

The format of the original date. This method uses the same formats as the Date.toString method. The default format is MM/DD/YEAR. Although the method supports the YY format for year, you are strongly encouraged to use 4-digit years. If you do use YY and the value of the year is greater than 50, then 1900 is added; otherwise, 2000 is added to derive the four-digit year.

Returns

A Date.

When Became Available

v7.0

Example

type String STR = "2004-08-16"

type Date DAT = STR.toDate("YEAR-MM-DD")  // (59763)