Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Date and Time Functions

There are some functions in the XPath formula builder using which you can parse or format strings that represent dates and times. These functions are:

- `format-dateTime(``format``,``dateTime``)`
- `format-date(``format``,``date``)`
- `format-time(``format``,``time``)`
- `parse-dateTime(``format``,``string``)`
- `parse-date(``format``,``string``)`
- `parse-time(``format``,``string``)`

The `format` parameter of these functions is based on the format patterns available for the `java.text.SimpleDateFormat` Java class. In the format parameter, unquoted alphabetic characters from `A` to `Z` and `a` to `z` represent the components of the date or time string. You can include non-pattern alphabetic characters in the string by quoting the text with single quotes. To include a single quote, use`’’`. The following table describes the alphabetic characters and their associated presentation in a date or time string.

Formatting characters in date or time strings
Letter | Description | Example
--- | --- | ---
    G
| Era Four or more `G`s return the full name of the era. | AD
    y
| year Two `y`s return two-digit year. | 2003; 03
    M
| Month in year Three or more `M`s return text name. | August; Aug; 08
    w
| Week in year | 48
    W
| Week in month | 3
    D
| Day in year | 254
    d
| Day in month | 28
    F
| Day of week in month | 3
    E
| Day in week Four or more `E`s return the full name of the weekday. | Friday; Fri
    a
| AM/PM marker Four or more `a`s return the full name. | AM
    H
| Hour in day (0-23) | 23
    k
| Hour in day (1-24) | 1
    K
| Hour in AM/PM (0-11) | 11
    h
| Hour in AM/PM (1-12) | 1
    m
| Minute in hour | 59
    s
| Second in minute | 48
    S
| Millisecond | 456
    z
| Time zone represented as a GMT offset. | GMT-08:00
    Z
| RFC 822 four-digit time zone format | -0800
all other letters | Reserved |

For any format pattern letter that returns a numeric value (for example, `w`, `h`, and `m`), the number of letters in the format pattern represents the minimum number of digits. For formatting functions, if the date or time has fewer digits than the number of pattern letters, the output is padded with zeros. For parsing functions, when the date or time has fewer digits than the number of characters in the format pattern, the extra characters are ignored, unless they are needed to determine the boundaries of adjacent fields.

The following table illustrates some example date and time format patterns and the resulting string.

Example date and time format patterns
Date/Time Pattern | Result
--- | ---
    "yyy.MM.dd G ’at’ HH:mm:ss"
    2003.3.11 AD at 09:43:56
    "EEE, MMM d, ’’yy"
    Tue, Mar 11, ’03
    "hh ’o’’clock’ a, zzzz"
    9 o’clock AM, GMT-8:00
    "K:mm a"
    0:08 PM
    "yyMMddHHmmssZ"
    010704120856-700

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.