Examples of Date and Time Formatting

Example: Gregorian Calendar


The following examples show a selection of dates and times and the way they might be formatted. These examples assume the use of the Gregorian calendar as the default calendar.

Required Output Expression
2002-12-31 format-date($d, "[Y0001]-[M01]-[D01]")
12-31-2002 format-date($d, "[M]-[D]-[Y]")
31-12-2002 format-date($d, "[D]-[M]-[Y]")
31 XII 2002 format-date($d, "[D1] [MI] [Y]")
31st December, 2002 format-date($d, "[D1o] [MNn], [Y]", "en", (), ())
31 DEC 2002 format-date($d, "[D01] [MN,*-3] [Y0001]", "en", (), ())
December 31, 2002 format-date($d, "[MNn] [D], [Y]", "en", (), ())
31 Dezember, 2002 format-date($d, "[D] [MNn], [Y]", "de", (), ())
Tisdag 31 December 2002 format-date($d, "[FNn] [D] [MNn] [Y]", "sv", (), ())
[2002-12-31] format-date($d, "[[[Y0001]-[M01]-[D01]]]")
Two Thousand and Three format-date($d, "[YWw]", "en", (), ())
einunddreißigste Dezember format-date($d, "[Dwo] [MNn]", "de", (), ())
3:58 PM format-time($t, "[h]:[m01] [PN]", "en", (), ())
3:58:45 pm format-time($t, "[h]:[m01]:[s01] [Pn]", "en", (), ())
3:58:45 PM PDT format-time($t, "[h]:[m01]:[s01] [PN] [ZN,*-3]", "en", (), ())
3:58:45 o'clock PM PDT format-time($t, "[h]:[m01]:[s01] o'clock [PN] [ZN,*-3]", "en")
15:58 format-time($t,"[H01]:[m01]")
15:58:45.762 format-time($t,"[H01]:[m01]:[s01].[f001]")
15:58:45 GMT+02:00 format-time($t,"[H01]:[m01]:[s01] [z]", "en", (), ())
15.58 Uhr GMT+02:00 format-time($t,"[H01]:[m01] Uhr [z]", "de", (), ())
3.58pm on Tuesday, 31st December format-dateTime($dt, "[h].[m01][Pn] on [FNn], [D1o] [MNn]")
12/31/2002 at 15:58:45 format-dateTime($dt, "[M01]/[D01]/[Y0001] at [H01]:[m01]:[s01]")


Example: Non-Gregorian Calendars

The following examples use calendars other than the Gregorian calendar.
These examples use non-Latin characters which might not display correctly in all browsers, depending on the system configuration.
Description Request Result
Islamic format-date($d, "[D١] [Mn] [Y١]", "Islamic", "ar", "AH", ()) ٢٦ ﺸﻭّﺍﻝ ١٤٢٣
Jewish (with Western numbering) format-date($d, "[D] [Mn] [Y]", "he", "AM", ()) ‏26 טבת 5763
Jewish (with traditional numbering) format-date($d, "[Dאt] [Mn] [Yאt]", "he", "AM", ()) כ״ו טבת תשס״ג
Julian (Old Style) format-date($d, "[D] [MNn] [Y]", "en", "OS", ()) 18 December 2002
Thai format-date($d, "[D๑] [Mn] [Y๑]", "th", "BE", ()) ๓๑ ธันวาคม ๒๕๔๕

Comments

Khaleel Shaik said…
Hi,

This is helpful to convert to a required format. Is there a way to accept the any predefined format and then to convert to one fo these required formats?

Or the incoming should be always the standard format?

-- Khaleel
Unknown said…
I am getting date from DataBase as 05-AUG-13 08.09.44.000000000 AM, and in BPEL it is different.
Is there a way so that i can convert BPEL date to this format 05-AUG-13 08.09.44.000000000 AM

format-date($d, "[D01] [MN,*-3] [Y0001]", "en", (), ())

xp20:current-dateTime( "[D01] [MN,*-3] [Y0001]")

amul said…
last day of month any idea

Popular posts from this blog

How to mount a WD Book Live as NFS in OEL6U3

ORA-44412: XE edition memory parameter invalid or not specified

Oracle SQL Developer 19.4 font too small