parse a string containing date information - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Finance : Date Arithmetic : Finance/ParseDate

Finance[ParseDate] - parse a string containing date information

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:

Date1:=ParseDateJan-02-2006

Date1:=RecordweekDay=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)

You can change the default file format by setting the _Env_FinanceDateFormat environment variable.

_Env_FinanceDateFormat:=%D

_Env_FinanceDateFormat:=%D

(6)

FormatDateDate1,default

January 2, 2006

(7)

01/02/06

01/02/06

(8)

FormatDateJan-02-2006,default

January 2, 2006

(9)

01/02/06

01/02/06

(10)

By default, the deduced date format will be used.

FormatDateDate1

Jan-02-2006

(11)

See Also

Finance[AddHoliday], Finance[AdjustDate], Finance[Calendar], Finance[DayOfWeek], Finance[IsBusinessDay], Finance[IsEndOfMonth], Finance[IsHoliday], Finance[JoinBusinessDays], Finance[JoinHolidays], Finance[RemoveHoliday]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam