Finance
ParseDate
parse a string containing date information
Calling Sequence
Parameters
Description
Notes
Examples
Compatibility
ParseDate(date)
ParseDate(date, format)
date
-
a string containing a date specification; date specification
format
deduce, default, or a string; (optional) date format
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
date format
deduce or string
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(...)).
with⁡Finance:
Date1≔ParseDate⁡Jan-02-2006
Date1≔Record⁡weekDay=2,monthDay=2,month=1,year=2006,format=%b-%d-%Y
FormatDate⁡Date1
Jan-02-2006
Date1:-format
%b-%d-%Y
FormatDate⁡Date1,default
January 2, 2006
FormatDate⁡Jan-02-2006,default
Date2≔ParseDate⁡2006/01/02,%Y/%m/%d
Date2≔Record⁡weekDay=2,monthDay=2,month=1,year=2006,format=%Y/%m/%d
Date2:-month
1
Date3≔ParseDate⁡01-02-06,%m-%d-%y
Date3≔Record⁡weekDay=2,monthDay=2,month=1,year=2006,format=%m-%d-%y
You can change the default date format by using the Finance[Settings] command.
Settings⁡dateformat=%D
%B %e, %Y
01/02/06
By default, the deduced date format will be used.
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]
Download Help Document