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 Under “Language”, the date display can be set to the appropriate language. Example: “de”

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

Example

Convert a date format. Input is OrderDate. Parameters are:

Sourceformat dd.MM.yyyy
Targetformat MMM
FirstDayOfWeek  
MinimalDaysInWeek  
Language de

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.

Below is an overview of the most important patterns:

Pattern

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

The pattern symbols q, Q, and v are Jedox Integrator-specific enhancements of the standard SimpleDateFormat, which can be found under
http://download.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html.

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

Language codes

en

English

es

Spanish

fr

French

de

German

More examples of language codes can be found at http://www.loc.gov/standards/iso639-2/php/English_list.php

The following parameters are only relevant if weeks are part of the source or target format:

FirstDayOfWeek:

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.

MinimalDaysInWeek:

The minimal days required in 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.
image_pdfimage_print
Was this post helpful?
NoYes (No Ratings Yet)
Loading...