Altova MapForce 2024 Enterprise Edition

Returns a value of type xs:dateTime built from any combination of the following parts as arguments: year, month, day, hour, minute, second, millisecond, and timezone. This function automatically normalizes the supplied parameters. For example, 32nd of January will automatically be changed to 1st of February.

mf-func-datetime-from-parts

 

Languages

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

 

Parameters

Name

Type

Description

year

xs:int

Provides the year.

month

xs:int

Provides the month.

day

xs:int

Provides the day of the month.

hour

xs:int

Optional. Provides the hour.

minute

xs:int

Optional. Provides the minute.

second

xs:int

Optional. Provides the second.

millisecond

xs:decimal

Optional. Provides the millisecond.

timezone

xs:int

Optional. Provides the timezone, in minutes. This value can be negative.

 

Example

The following mapping constructs an xs:dateTime value from parts that are supplied by constants.

mf-func-datetime-from-parts-example

The mapping output is 2020-04-17T08:58:54.333-01:00.

 

For another example, see the IDoc_Order.mfd mapping from the <Documents>\Altova\MapForce2024\MapForceExamples\ folder. This mapping illustrates how to read data from SAP IDoc instance files. It contains a user-defined function "convertIDOCDate" which assembles the xs:dateTime value from two input strings, using the left-trim and substring functions.

mf-func-datetime-from-parts-example2

 

The dateString and timeString components are parameters to the user-defined function. They are supplied by the main mapping, from the SAP IDoc instance file:

mf-func-datetime-from-parts-example3

In this mapping, the date value as a string is 19990621. The time value is 0930. Consequently, the datetime-from-parts function returns the value 1999-06-21T09:30:00. This value is also the result of the user-defined function and is written to the Received item of the target XML document.

© 2017-2023 Altova GmbH