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:
Choose the attributes to reformat and replace.
Specified the expected format of the source date. See the ‘Date Format Symbols’ section for details on how to specify the date.
If you do not know the format, select Unknown – Automatic Detection and the system will try to interpret values as a date. It is recommended whenever possible to provide the Source Date Format to avoid unexpected results. In particular, when using ISO8601 point-in-time specifications, the output could vary depending on the local timezone, if the timezone information is not part of the data/time string.
The destination format that valid dates are converted to. See the ‘Date Format Symbols’ section for details on how to specify the date.
If the value of the attribute does not match the specified Source Date Format, it will be considered invalid and set to the specified value. For more information about options for setting this parameter, see Transformer Parameter Menu Options.
Since the DateFormatter supports relative dates, dates that match the format but can overflow are considered to be valid. For example, if the Source Date Format is set to %Y%m%d, an attribute with value ‘20090133’ will be set to ‘20090202’. However, if the Source Date Format is %Y%m%d%H%M%S, an attribute with value ‘20090133’ will be considered an invalid date.
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 (for example, 1990) |
%Z |
Time zone name. |
When using automatic detection:
Type | Description |
---|---|
Time |
Time of the day. Acceptable formats are: hh[:mm[:ss]] [meridian] [zone] hhmm [meridian] [zone] If no meridian is specified, hh is interpreted on a 24-hour clock. Warning: An integer less than 24 will be interpreted as an hour, with the date assumed to be today's date. Therefore, an input of "0" is taken to mean "today at midnight." If zero values are to be considered invalid, they must be filtered using a Tester before reaching the DateFormatter. |
Date |
A specific month and day with optional year. The acceptable formats are: mm/dd[/yy] monthname dd [, yy] dd monthname [yy] day (for example, Monday) The default year is the current year. If the year is less than 100, we treat the years 00-68 as 2000-2068 and the years 69-99 as 1969-1999. Note: Some older UNIX and Windows platforms cannot represent the years 38-70, so an error may result if these years are used. |
ISO 8601 point-in-time |
An ISO 8601 point-in-time specification, such as YYYYMMDDThhmmss, where T is the literal T, YYYYMMDD hhmmss, or YYYYMMDDThh:mm:ss. Note: Output may vary depending on your local timezone if timezone information is not part of the date/time specification. |
Relative time |
A specification relative to the current time. The format is number unit. Acceptable units are year; fortnight; month; week; day; hour; minute (or min); second (or sec). The unit can be specified as a singular or plural, as in 3 weeks. These modifiers may also be specified: tomorrow; yesterday; today; now; last; next; ago. The actual date is calculated according to the following steps. First, any absolute date and/or time is processed and converted. Using that time as the base, day-of-week specifications are added. Next, relative specifications are used. If a date or day is specified, and no absolute or relative time is given, midnight is used. Finally, a correction is applied so that the correct hour of the day is produced after allowing for daylight savings time differences and the correct date is given when going from the end of a long month to a short month. Daylight savings time correction is applied only when the relative time is specified in units of days or more, i.e., days, weeks, fortnights, months or years. |
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.
Associated FME function or factory: @Tcl2
Search for samples and information about this transformer on the FME Knowledge Center.