Altova MapForce 2025 Enterprise Edition

Converts a string into a date. This function uses the parse-dateTime function as a basis, while ignoring the time component. The result is of type xs:date.

mf-func-parse-date

 

Languages

Built-in, C++, C#, Java.

 

Parameters

Argument

Description

value

Mandatory argument. Supplies the string value to be converted.

format

Mandatory argument. Supplies a format string. This argument is used in the same way as the format argument in the parse-dateTime function.

 

Example

The mapping below parses the string "01 Apr 2015", converts it to a date and writes the result to a target item (pubdate) of type xs:date. This was achieved by using the format [D01] [MNn,3-3] [Y], where:

 

[D01] is the date of the month, expressed as two digits

[MNn,3-3] is the month name, with a minim and maximum width of 3 characters

[Y] is the year

mf-func-parse-date-example

The result is as follows (excluding the XML and namespace declarations):

 

<book>
  <title>Linux Bible</title>
  <pubdate>2015-04-01</pubdate>
</book>

 

See also Example: Mapping Data from an RSS Feed.

© 2018-2024 Altova GmbH