格式化日期/時間Format Date/Time

重要

此版本的 Orchestrator 已達終止支援,建議您 升級至 Orchestrator 2019This version of Orchestrator has reached the end of support, we recommend you to upgrade to Orchestrator 2019.

「格式化日期/時間」活動可讓您將現有日期和時間格式轉換成您建立的自訂格式。The Format Date/Time activity enables you to transform existing date and time formats into custom formats that you create.

設定格式化日期/時間活動Configuring the Format Date/Time Activity

設定「格式化日期/時間」活動之前,您需要決定下列各項:Before you configure the Format Date/Time activity, you need to determine the following:

  • 您要轉換的現有日期和時間格式。The existing date and time format you want to transform.

  • 您要它成為的新日期和時間格式。The new date and time format you want it to become.

您可以使用下列資訊來設定「格式化日期/時間」活動。Use the following information to configure the Format Date/Time activity.

[詳細資料] 索引標籤Details Tab

設定Settings 組態指示Configuration Instructions
日期/時間Date/Time 鍵入您要轉換的時間。Type the time that you want to convert.
格式Format 鍵入您要轉換的時間格式。Type the format of the time that you want to convert. 如需格式代碼和範例,請參閱日期/時間格式代碼表。See the Date/Time Format Codes table for format codes and examples.
格式Format 鍵入輸入時間的目標轉換格式。Type the format that you want to convert the input time to.
輸出調整Output Adjustments 在下列任何欄位鍵入數字,以便從輸入時間調整輸出時間。Type a number in any of the following fields to adjust the output time from the input time. 例如,如果輸入時間來自比您當地時間快三個小時的伺服器,請在 [小時] 欄位中鍵入 -3,將輸出時間 (您的當地時間) 設定為比輸入時間晚三個小時。For example, if the input time is coming from a server that is three hours ahead of your local time, type -3 in the Hours field to set the output time (your local time) to three hours behind the input time. 如果輸入時間比您的當地時間晚三個小時,則請鍵入 3,將輸出時間設為比輸入時間快三個小時。If the input time is three hours behind your local time, type 3 to set the output time to three hours ahead of the input time.

您可以使用下列時間單位來調整輸出時間:You can adjust the output time using the following time units:

Days

MonthsMonths

YearsYears

小時Hours

分鐘Minutes

Seconds

若要指定日期/時間格式,您必須輸入代表日期和時間每個部分的代碼。To specify a date/time format, you must enter the codes that represent each part of the date and time.

日期/時間格式代碼Date/Time Format Codes

程式碼Code 描述Description
yy 年份的最後一位數字。The last digit of the year. 例如,2005 年會以 5 表示。For example, 2005 would be represented as 5.
yyyy 年份數字的最後兩位數字。The last two digits of the year number. 例如,這種格式的 2005 年會以 05 表示。For example, in this format 2005 would be represented as 05.
yyyyyyyy 四位數的年份數字。The year number in four digits. 例如,這種格式的 2005 年會以 2005 表示。For example, in this format 2005 would be represented as 2005.
MM 從數字 1 到 12 的月份。Month as a number from 1 to 12. 如果月份數字只有單一位數,它顯示時不會有前置零。If the month number is a single-digit number, it is displayed without a leading zero.
MMMM 兩位數的月份。Month in two digits. 如果月份數字只有單一位數,它顯示時會有前置零。If the month number is a single-digit number, it is displayed with a leading zero.
MMMMMM 三個字母的月份名稱。The name of the month in three letters. 例如,8 月會以 Aug 表示。For example, August would be represented as Aug.
MMMMMMMM 完整拼出的月份名稱。The name of the month spelled in full. 只有針對輸出時間,才支援這個格式。This format is supported only for output time. 注意: 只有針對輸出格式,才支援這個格式。Note: This format is only supported for the output format.
dd 從數字 1 到 31 的日期。Day as a number from 1 to 31. 如果日期數字只有單一位數,它顯示時不會有前置零。If the day number is a single-digit number, it is displayed without a leading zero.
dddd 兩位數的日期。Day in two digits. 如果日期數字只有單一位數,它顯示時會有前置零。If the day number is a single-digit number, it is displayed with a leading zero.
dddddd 三個字母的星期幾縮寫名稱。The abbreviated name of the day of the week in three letters. 例如,星期六會縮寫為 "Sat"。For example, Saturday is abbreviated as “Sat”.
dddddddd 星期幾的完整名稱。The full name of the day of the week. 例如,星期六會完整顯示。For example, Saturday is displayed in full. 注意: 只有針對輸出格式,才支援這個格式。Note: This format is only supported for the output format.
hh 使用 12 小時制時,從數字 1 到 12 的小時。Hour as a number from 1 to 12 when using the 12-hour clock. 如果小時數字只有單一位數,它顯示時不會有前置零。If the hour number is a single-digit number, it is displayed without a leading zero.
hhhh 使用 12 小時制的兩位數小時。Hour in two digits using the 12-hour clock. 如果小時數字只有單一位數,它顯示時會有前置零。If the hour number is a single-digit number, it is displayed with a leading zero.
HH 使用 24 小時制時,從數字 0 到 23 的小時。Hour as a number from 0 to 23 when using the 24-hour clock. 例如,這種格式的下午 1 點會以 13 表示。For example, in this format 1 pm would be represented as 13. 如果小時數字只有單一位數,它顯示時不會有前置零。If the hour number is a single-digit number, it is displayed without a leading zero.
HHHH 使用 24 小時制的兩位數小時。Hour in two digits using the 24-hour clock. 例如,這種格式的下午 1 點會以 13 表示。For example, in this format 1 pm would be represented as 13. 如果小時數字只有單一位數,它顯示時會有前置零If the hour number is a single-digit number, it is displayed with a leading zero
mm 從數字 0 到 59 的分鐘。Minutes as a number from 0 to 59. 如果分鐘數字只有單一位數,它顯示時不會有前置零。If the minute number is a single-digit number, it is displayed without a leading zero.
mmmm 兩位數的分鐘。Minutes in two digits. 如果分鐘數字只有單一位數,它顯示時會有前置零。If the minute number is a single-digit number, it is displayed with a leading zero.
ss 從數字 0 到 59 的秒鐘。Seconds as a number from 0 to 59. 如果秒鐘數字只有單一位數,它顯示時不會有前置零。If the second number is a single-digit number, it is displayed without a leading zero.
ssss 兩位數的秒鐘。Seconds in two digits. 如果秒鐘數字只有單一位數,它顯示時會有前置零。If the second number is a single-digit number, it is displayed with a leading zero.
tttt A.M.A.M. 語意模糊。or P.M. 以兩個字母表示:A.M.as two letters: A.M. 語意模糊。or P.M. 如您系統中所定義。as defined on your system.

以下是一些範例日期和時間,及其對應的格式:Here are some examples of dates and times and their corresponding format:

格式Format DateDate
MM/dd/yyyy hh: mm: ttMM/dd/yyyy hh:mm:ss tt 08/05/2006 03:05:15 PM08/05/2006 03:05:15 PM
M/yy h :m:s ttM/d/yy h :m:s tt 8/5/06 3:5:15 PM8/5/06 3:5:15 PM
ddd MMM dd yyyyddd MMM dd yyyy Sat Aug 05 2006Sat Aug 05 2006
dddd, MMMM dd yyyydddd, MMMM dd yyyy Saturday, August 05 2006Saturday, August 05 2006

已發佈資料Published Data

下表列出已發佈的資料項目。The following table lists the published data items.

ItemItem 描述Description
格式化結果Format Result 以指定格式表示的格式化結果。The result of the format in the specified form.
未經調整的格式化結果Format Result without adjustments 格式化的結果,但不做任何調整。The formatted result, but without any adjustments made to it.
輸入時間Input Time 輸入時間。The input time.
輸入格式Input Format 輸入作為輸入時間的日期和時間格式。The format of the date and time that was entered as the input time.
輸出格式Output Format 輸入作為輸出時間的日期和時間格式。The format of the date and time that was entered as the output time.