PowerApps 中的 Calendar 和 Clock 函式Calendar and Clock functions in PowerApps

擷取關於目前地區設定的 Calendar 和 Clock 資訊。Retrieves calendar and clock information about the current locale.

說明Description

CalendarClock 函式是一組會擷取目前地區設定相關資訊的函式。The Calendar and Clock functions are a set of functions that retrieve information about the current locale.

您可以使用這些函式以目前使用者的語言顯示日期和時間。You can use these functions to display dates and times in the language of the current user. CalendarClock 函式所傳回的單一資料行資料表可直接與下拉式清單和清單方塊控制項的 Items 屬性搭配使用。The single-column tables returned by Calendar and Clock functions can be used directly with the Items property of Dropdown and Listbox controls.

函式Function 說明Description
Calendar.MonthsLong()Calendar.MonthsLong() 包含每個月完整名稱的單一資料行資料表,以 "January" 為開頭。Single-column table containing the full names of each month, starting with "January".
Calendar.MonthsShort()Calendar.MonthsShort() 包含每個月縮寫名稱的單一資料行資料表,一月以 "Jan" 為開頭。Single-column table containing the abbreviated names of each month, starting with "Jan" for January.
Calendar.WeekdaysLong()Calendar.WeekdaysLong() 包含每個工作日完整名稱的單一資料行資料表,以 "Sunday" 為開頭。Single-column table containing the full names of each weekday, starting with "Sunday".
Calendar.WeekdaysShort()Calendar.WeekdaysShort() 包含每個工作日完整名稱的單一資料行資料表,星期日以 "Sun" 為開頭。Single-column table containing the full names of each weekday, starting with "Sun" for Sunday.
Clock.AmPm()Clock.AmPm() 包含長大寫 "AM" 與 "PM" 表示法的單一資料行資料表。Single-column table containing the long uppercase "AM" and "PM" designations. 如果語言使用 24 小時制,資料表將為空白。If the language uses a 24-hour clock, the table will be empty.
Clock.AmPmShort()Clock.AmPmShort() 包含簡短大寫 "A" 與 "P" 表示法的單一資料行資料表。Single-column table containing the short uppercase "A" and "P" designations. 如果語言使用 24 小時制,資料表將為空白。If the language uses a 24-hour clock, the table will be empty.
Clock.IsClock24()Clock.IsClock24() 表示此地區設定是否使用 24 小時制的布林值。Boolean indicating if a 24-hour clock is used in this locale.

使用 Text 函式來以相同的資訊格式化日期和時間值。Use the Text function to format date and time values using this same information. Language 函式會傳回目前的語言和區域碼。The Language function returns the current language and region code.

語法Syntax

Calendar.MonthsLong()Calendar.MonthsLong()

Calendar.MonthsShort()Calendar.MonthsShort()

Calendar.WeekdaysLong()Calendar.WeekdaysLong()

Calendar.WeekdaysShort()Calendar.WeekdaysShort()

Clock.AmPm()Clock.AmPm()

Clock.AmPmShort()Clock.AmPmShort()

Clock.IsClock24()Clock.IsClock24()

範例Examples

  1. 插入下拉式控制項。Insert a Dropdown control.
  2. Items 屬性的公式設為:Set the formula for the Items property to:

    • Calendar.MonthsLong()Calendar.MonthsLong()
  3. 應用程式的使用者現在可以在自己的語言中選取月份。Users of your app can now select a month in their own language. MonthsLong 可以使用 Calendar 傳回的任何單一資料行資料表來取代,以建立工作日和時間選擇器。MonthsLong can be replaced with any of the single-column tables that are returned by Calendar to create weekday and time selectors.

在美國境內,Language 會傳回 "EN-US",下列會由 Calendar 函式傳回︰In the United States, with Language returning "en-US", the following is returned by the Calendar functions:

公式Formula 說明Description 結果Result
Calendar.MonthsLong()Calendar.MonthsLong() 傳回值會包含每個月的完整名稱,以「一月」為開頭。The return value contains the full names of each month, starting with "January". [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ][ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
Calendar.MonthsShort()Calendar.MonthsShort() 傳回值會包含每個月的縮寫名稱,以 "January" 為開頭。The return value contains the the abbreviated names of each month, starting with "January". [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ][ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]
Calendar.WeekdaysLong()Calendar.WeekdaysLong() 傳回值會包含每個月的完整名稱,以 "Sunday" 為開頭。The return value contains the the full names of each month, starting with "Sunday". [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ][ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]
Calendar.WeekdaysShort()Calendar.WeekdaysShort() 傳回值會包含每個月的縮寫名稱,以 "Sunday" 為開頭。The return value contains the the abbreviated names of each month, starting with "Sunday". [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ][ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
Clock.AmPm()Clock.AmPm() 此語言會使用 12 小時制。This language uses a 12-hour clock. 傳回值包含完整 AM 和 PM 表示法的大寫版本。The return value contains the uppercase versions of the full AM and PM designations. [ "AM", "PM" ][ "AM", "PM" ]
Clock.AmPmShort()Clock.AmPmShort() 此語言會使用 12 小時制。This language uses a 12-hour clock. 傳回值包含簡短 AM 和 PM 表示法的大寫版本。The return value contains the uppercase versions of the short AM and PM designations. [ "A", "P" ][ "A", "P" ]
Clock.IsClock24()Clock.IsClock24() 此語言會使用 12 小時制。This language uses a 12-hour clock. falsefalse