ParseDate - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Finance

  

ParseDate

  

parse a string containing date information

 

Calling Sequence

Parameters

Description

Notes

Examples

Compatibility

Calling Sequence

ParseDate(date)

ParseDate(date, format)

Parameters

date

-

a string containing a date specification; date specification

format

-

deduce, default, or a string; (optional) date format

Description

• 

The ParseDate command parses the string date assumed to contain date information according to the parsing specification given by the format string format. The date format can be any format specification as described in StringTools[ParseTime].

• 

If the format string is missing, several standard date formats are tried. The first format to succeed will be used. The "standard" date formats are "%d-%b-%Y", "%d-%b-%y", "%d-%m-%Y", "%d-%m-%y", "%b-%d-%Y", "%b-%d-%y", "%Y-%b-%d", and "%Y-%m-%d", and its variations obtained by replacing all minus signs by one of the characters " " (space), "," (comma), "/" (slash), or ":" (colon).

• 

The record returned by ParseDate contains slots with the following meanings and ranges of values:

monthDay

day of the month

1..31

month

month of the year

1..12

year

the year

0..9999

format

date format

deduce or string

Notes

• 

If you call ParseDate multiple times with the same input, then typically the same record will be returned. For this reason, you should not modify the record returned by ParseDate: if you do, then the next call will likely get the modified record back. Instead, if you need to modify the result, then do this with a copy of the record. You can create such a copy, for example, with the calling sequence copy(ParseDate(...)).

Examples

withFinance:

Date1ParseDateJan-02-2006

Date1RecordweekDay=2,monthDay=2,month=1,year=2006,format=%b-%d-%Y

(1)

FormatDateDate1

Jan-02-2006

(2)

Date1:-format

%b-%d-%Y

(3)

FormatDateDate1,default

January 2, 2006

(4)

FormatDateJan-02-2006,default

January 2, 2006

(5)

Date2ParseDate2006/01/02,%Y/%m/%d

Date2RecordweekDay=2,monthDay=2,month=1,year=2006,format=%Y/%m/%d

(6)

Date2:-month

1

(7)

Date3ParseDate01-02-06,%m-%d-%y

Date3RecordweekDay=2,monthDay=2,month=1,year=2006,format=%m-%d-%y

(8)

You can change the default date format by using the Finance[Settings] command.

Settingsdateformat=%D

%B %e, %Y

(9)

FormatDateDate1,default

01/02/06

(10)

FormatDateJan-02-2006,default

01/02/06

(11)

By default, the deduced date format will be used.

FormatDateDate1

Jan-02-2006

(12)

Compatibility

• 

The Finance[ParseDate] command was introduced in Maple 15.

• 

For more information on Maple 15 changes, see Updates in Maple 15.

See Also

Finance[AddHoliday]

Finance[AdjustDate]

Finance[Calendar]

Finance[DayOfWeek]

Finance[FormatDate]

Finance[IsBusinessDay]

Finance[IsEndOfMonth]

Finance[IsHoliday]

Finance[JoinBusinessDays]

Finance[JoinHolidays]

Finance[RemoveHoliday]