语法
Time.ToText(time as nullable time, optional options as any, optional culture as nullable text) as nullable text
关于
返回 time 的文本化表示形式。 可以提供可选 record 参数 options 来指定额外的属性。 culture 仅用于旧工作流。 record 可以包含以下字段:
Format:一个text值,指示要使用的格式。 有关详细信息,请转到 https://go.microsoft.com/fwlink/?linkid=2180104 和 https://go.microsoft.com/fwlink/?linkid=2180105。 省略此字段或提供null将导致使用由Culture定义的默认值设置日期的格式。Culture:如果Format不为 null,则Culture会控制某些格式说明符。 例如,in"en-US"是,而 in"tt""ar-EG"是"ص" or "م"。"AM" or "PM""tt"当Format为null时,Culture控制要使用的默认格式。 当Culture为null或被省略时,将使用 Culture.Current。
若要支持旧工作流,options 和 culture 也可以是文本值。 这与 options = [Format = options, Culture = culture] 具有相同的行为。
示例 1
将 #time(01, 30, 25) 转换为 text 值。 结果输出可能因当前区域性而异。
使用情况
Time.ToText(#time(11, 56, 2))
输出
"11:56 AM"
示例 2
使用自定义格式和德语区域性进行转换。
使用情况
Time.ToText(#time(11, 56, 2), [Format="hh:mm", Culture="de-DE"])
输出
"11:56"
示例 3
使用标准时间格式进行转换。
使用情况
Time.ToText(#time(11, 56, 2), [Format="T", Culture="de-DE"])
输出
"11:56:02"