日期Formatter
The source string must be in a date and/or time format supported by the transformer. For additional information, see theSource Date Formatparameter.
Limitations:
- 日期s earlier than 1902 are not supported.
- If your date string contains ".", then theSource Date Formatparameter must be specified. For example, to process dates like23.03.2015,source format%d。%y%yis required.
- 不支持分数秒。例如,对于日期字符串2015-03-23 10:23:45.213,.213will be ignored when usingUnknown - Automatic Detection.
Parameters
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
Choose the attributes to reformat and replace.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
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, selectUnknown – Automatic Detectionand the system will try to interpret values as a date. It is recommended whenever possible to provide theSource Date Formatto 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.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
The destination format that valid dates are converted to. See the ‘Date Format Symbols’ section for details on how to specify the date.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
If the value of the attribute does not match the specifiedSource Date Format, it will be considered invalid and set to the specified value. For more information about options for setting this parameter, seeTransformer 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 theSource Date Format被设定为%Y%m%d, an attribute with value ‘20090133’ will be set to ‘20090202’. However, if theSource Date Formatis %Y%m%d%H%M%S, an attribute with value ‘20090133’ will be considered an invalid 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 |
缩写的工作日名称(mon,tue等)。 |
%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 |
日期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 |
小时以12小时格式,没有领先的零(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 |
工作日编号(星期一= 1,星期日= 7)。 |
%U |
一周(00 - 52),周日是一周的第一天。 |
%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. |
Automatic Detection
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
When using automatic detection:
- The source date is assumed to be in a standard date and/or time string, which can include standard time zone mnemonics. If only a time is specified, the current date is assumed. If the string does not contain a time zone mnemonic, the local time zone is assumed.
- 在10/11/99等数值日期中,第一号总是被解释为月份。(所以给定的日期是10月11日,而不是11月10日。)因此,13/1/05等日期将产生错误,因为13是无效的月份。如果已知日期是表单DD / mm / yy,则Source Date Formatparameter should be used to specify the format as %d/%m/%y.
- 每个日期是基于逐个处理; no attempt is made to determine a common format amongst all input.
- 相对日期:遗传代数dateformat可以接受ive dates as an input string. For example, if today is Monday, 25-Oct-2010, it can convertnext thursdayto "28-Oct-2010" orthree years agoto "25-Oct-2007". See the FME Knowledge Center link below for workspace examples.
- If the source attribute is a 14-digit number andSource Date Format被设定为Unknown – Automatic Detection, its format will be interpreted as YYYYMMDDHHMMSS, as formatted by the Oracle reader.
- 源日期可以包含以下类型的零或多种规格:
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 aTesterbefore reaching the DateFormatter. |
日期 | A specific month and day with optional year. The acceptable formats are: mm / dd [/ yy] 仓名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. 实际日期是根据以下步骤计算的。首先,处理和转换任何绝对日期和/或时间。使用该时间作为基础,添加了一天的日常规范。接下来,使用相对规格。如果指定了日期或日期,则不给出绝对或相对时间,使用午夜。最后,应用了校正,以便在允许日光节省时间差异之后产生当天的正确时间,并且从长期结束到短暂的一个月时给出了正确的日期。仅当以天或更长时间为单位或更长时间指定的相对时间,即天,周,四周,月或年来时,才应用夏令时校正。 |
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, clickbeside the applicable parameter. For more information, seeTransformer Parameter Menu Options.
Transformer Categories
搜索FME知识中心
搜索有关此变压器的样本和信息FME Knowledge Center.