DateFormat Function

image_pdfimage_print

With the DateFormat function, a date or time input can be converted into another date or time format. One input field is necessary for DateFormat. 

Parameters
Source format Defines the date format of the input field. Example: “dd.MM.yyyy”
Target format Defines the date format of the output field. Example: “MMM”
Language Sets the input and output language. Any Jedox-supported language can be selected.
Complete week

 If the box is checked, then the first or last week of the year will contain 7 days and might contain dates from 2 years, i.e. 2018 and 2019.

If the box is not checked, then both the first and last weeks of the year may contain less than 7 days, but each week will only contain days from a single year.

First day of the week
Sets the first day of the week. Sunday=1, Monday=2, … Saturday=7. If not set, the language-specific value is used, e.g. 1 in US and 2 in France. Note: this parameter is only required if weeks are part of the source or target format.
Minimum of days in first week
The minimal days required for the first week of the year. For example, if the first week is defined as one that contains the first day of the first month of a year, it is 1. If it must be a full week, it is 7. If not set, the language-specific value is used. Note: this parameter is only required if weeks are part of the source or target format.

If the new date format is to contain fixed text elements, this can be defined with single quotation marks (‘Text’).

Details on date format schema

Letters from A to Z (and a to z) that are not in quotation marks will be interpreted as text patterns representing a date or time. To avoid being interpreted as a time pattern, text can be given in single quotation marks (‘). “”” is an apostrophe. All other symbols are simply copied into the display string (for Targetformat) or compared with the entry (for Sourceformat).

Sample characters are generally repeated, as the number thereof defines the exact display. For example, if the number of sample characters is 4, the full form is used for text (e.g. “January”). A shortened form (e.g. “Jan”) will be used if it exists. For numbers, the number of sample characters is the minimum number of digits shown. An appropriate number of zeros is therefore added to the beginning of smaller numbers.

As of Jedox 2018.4, DateFormat functions with short month as the target format (i.e. MMM yyyy) return the date in the form e.g. “Jan. 2018” (see screenshot below). Earlier versions returned e.g. “Jan 2018”. This change is a result in the use of OpenJDK 11, introduced in Jedox 2018.4, which uses CLSR unicode standards. Note that this formatting is specific for only a few languages, including German. See the following articles for more information: https://bugs.openjdk.java.net/browse/JDK-8212755 and http://cldr.unicode.org/translation/date-time.

The function DateFormat recognizes the letters of the standard SimpleDateFormat, which can be found under
http://download.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html (not all are useful for this function).

The letters q, Q, and v are Jedox Integrator-specific enhancements of the standard SimpleDateFormat.

Below is an overview of the most used letters for the function DateFormat:

Letter

Meaning

Result for 31.12.2014

d

Day in month

31

D

Day in year

365

E

Day in week

EEE: Wed, EEEE: Wednesday

M

Month in year

MM: 12, MMM: Dec, MMMM: December

q

Half year

2

Q

Quarter in year

4

v

Week in year (corresponding to y)

53

w

Week in year (corresponding to Y)

1

W

Week in month

 5

y

Year

yyyy: 2014, yy: 14

Y

Week year

2015

 

Examples
dd.MM.yyyy 04.09.2008
EEE, d MMM yyyy Wed, 4 Sep 2008
MMMM September

Language codes

DateFormat function offers country-specific localization. Possible inputs for language are <language>_<country>. For example, English can be selected as en_US or en_UK, and German can be selected for de_DE or de_AT. More examples of language codes can be found at https://www.oracle.com/technetwork/java/javase/documentation/java11locales-5069639.html.

If no language is specified, then the system default language and country is used.

image_pdfimage_print