You are here: CalculatorsDateFormatter

DateFormatter

Reformats and replaces date or time strings into a new date format.

The source string must be in a date and/or time format supported by the transformer.  For additional information, see the Source Date Format parameter.

Limitations:

  • Dates earlier than 1902 are not supported.
  • If your date string contains ".", then the Source Date Format parameter must be specified. E.g., to process dates like 23.03.2015, the source format %d.%m.%Y is required.
  • Fractional seconds are not supported. E.g., for the date string 2015-03-23 10:23:45.213, the .213 will be ignored when using Unknown - Automatic Detection.

Parameters

Date Format Symbols

The format specifiers determine the format for the destination and source date format parameters.

"-"

Quoted strings (%Y"-"%m"-"%d)

%%

Insert a percent symbol (%)

%a

Abbreviated weekday name (Mon, Tue, etc.).

%A

Full weekday name (Monday, Tuesday, etc.).

%b

Abbreviated month name (Jan, Feb, etc.) (same as %h).

%B

Full month name.

%c

Locale specific date and time. The format for date and time in the default "C" locale on UNIX/Mac is "%a %b %d %H:%M:%S %Y". On Windows, this value is the locale specific long date and time, as specified in the Regional Options control panel settings.

%C

First two digits of the four-digit year (19 or 20).

%d

Day of month (01 - 31).

%D

Date as %m/%d/%y.

%e

Day of month (1 - 31), no leading zeros.

%h

Abbreviated month name (Jan, Feb, etc.) (same as %b).

%H

Hour in 24-hour format (00 - 23).

%I

Hour in 12-hour format (01 - 12).

%j

Day of year (001 - 366).

%k

Hour in 24-hour format, without leading zeros (0 - 23).

%l

Hour in 12-hour format, without leading zeros (1 - 12).

%m

Month number (01 - 12).

%M

Minute (00 - 59).

%n

Insert a newline.

%p

AM/PM indicator.

%r

Time in a locale-specific "meridian" format. The "meridian" format in the default "C" locale is "%I:%M:%S %p".

%R

Time as %H:%M.

%s

Count of seconds since the epoch, expressed as a decimal integer.

%S

Seconds (00 - 59).

%t

Insert a tab.

%T

Time as %H:%M:%S.

%u

Weekday number (Monday = 1, Sunday = 7).

%U

Week of year (00 - 52), Sunday is the first day of the week.

%V

Week of year according to ISO-8601 rules. Week 1 of a given year is the week containing 4 January.

%w

Weekday number (Sunday = 0, Saturday = 6).

%W

Week of year (00 - 52), Monday is the first day of the week.

%x

Locale-specific date format. The format for a date in the default "C" locale for UNIX/Mac is "%m/%d/%y". On Windows, this value is the locale-specific short date format, as specified in the Regional Options control panel settings.

%X

Locale-specific 24-hour time format. The format for a 24-hour time in the default "C" locale for UNIX/Mac is "%H:%M:%S". On Windows, this value is the locale-specific time format, as specified in the Regional Options control panel settings.

%y

Year without century (00 - 99).

%Y

Year with century (e.g. 1990)

%Z

Time zone name.

Automatic Detection

Editing Transformer Parameters

Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.

Transformer Categories

Calculators

Search FME Knowledge Center

Search for samples and information about this transformer on the FME Knowledge Center.