parse-dateTime

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions > Function Library Reference > core | conversion functions >

parse-dateTime

Available for Java, C#, C++, and the Built-in execution engine.

fn-parseDatetime

Converts a date/time value expressed as a string into a value of type dateTime. This function takes the following arguments:

 

Argument

Description

value

The string value to be converted.

format

Specifies the format mask to apply to value.

 

For example, in the mapping below, the string value 315 2004 +01:00 specifies the 315th day of year 2004, in the time zone GMT+01:00. This value is converted into its dateTime equivalent, by applying the format mask [d] [Y] [Z].

fn-parseDatetime2

 

The result is as follows:

fn-parseDatetime3

 

A format mask can consist of the following components:

 

Component

Description

Default Presentation

Y

year (absolute value)

four digits (2010)

M

month of the year

1-12

D

day of month

1-31

d

day of year

1-366

H

hour (24 hours)

0-23

h

hour (12 hour)

1-12

P

A.M. or P.M.

alphabetic (language dependent)

m

minutes in hour

00-59

s

seconds in minute

00-59

f

fractional seconds

numeric, one decimal place

Z

timezone as a time offset from UTC

+08:00

z

timezone as a time offset using GMT

GMT+n

 

Some of the components above take modifiers (for example, they can be used to interpret a date either as a single digit or as two digits):

 

Modifier

Description

Example

1

decimal numeric format with no leading zeros: 1, 2, 3, ...

1, 2, 3

01

decimal format, two digits: 01, 02, 03, ...

01, 02, 03

N

name of component, upper case

FEBRUARY, MARCH

n

name of component, lower case

february, march

Nn

name of component, title case

February, March

 

Note:N, n, and Nn modifiers support only the component M (month).

 

The table below lists a few more examples:

 

Value

Format

Result

21-03-2002 16:21:12.492 GMT+02:00

[D]-[M]-[Y] [H]:[m]:[s].[f] [z]

2002-03-21T16:21:12.492+02:00

315 2004 +01:00

[d] [Y] [Z]

2004-11-10T00:00:00+01:00

1.December.10 03:2:39 p.m. +01:00

[D].[MNn].[Y,2-2] [h]:[m]:[s] [P] [Z]

2010-12-01T15:02:39+01:00

20110620

[Y,4-4][M,2-2][D,2-2]

2011-06-20T00:00:00


© 2019 Altova GmbH