You are here: Strings > 日期Formatter

日期Formatter

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 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

日期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

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

Calculated Values

Strings

搜索FME知识中心

搜索有关此变压器的样本和信息FME Knowledge Center.