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

检索有关当前区域设置的日历和时钟信息。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() 包含每个工作日完整名称的单列表,从“星期日”开始。Single-column table containing the full names of each weekday, starting with "Sunday".
Calendar.WeekdaysShort()Calendar.WeekdaysShort() 包含每个工作日缩写的单列表,从“星期日”的缩写“周日”开始。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() 返回值包含每月的完整名称,从“January”开始。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() 返回值包含每个工作日的完整名称,从“星期日”开始。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() 返回值包含每个工作日的缩写,从“周日”开始。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