Previous Topic: nowNext Topic: resetResource


parseDate

The parseDate function returns a date object after parsing the specified string in the required format.

Syntax

dtDate = parseDate(dateStr, format)

Arguments

dateStr (String)

Specifies the string that needs to be parsed as a date.

format (String)

Specifies the format required to interpret the date string provided; for example: MM/dd/yyyy.

Return Value

dtDate (Date)

Date equivalent of input dateStr String as parsed using the input format String.

Examples

  1. Sets dtDate to a value of Dec 10, 2009 12:00:00 AM, when the format is MM/dd/yyyy.
    dtDate = parseDate('12/10/2009','MM/dd/yyyy')
    
  2. Sets dtDate to a value of Oct12, 2009 12:00:00 AM, when the format is dd/MM/yyyy
    dtDate = parseDate('12/10/2009','dd/MM/yyyy')
    
  3. Fails the following input because the input date string does not match the input format.
    dtDate = parseDate('12-10-/2009','dd/MM/yyyy')