Time.ToText
返回时间值的文本表示形式。
Syntax
Time.ToText(
time as time,
optional options as any,
optional culture as text
) as text
Remarks
返回 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将控制某些格式说明符。例如,在"en-US"中,"tt"是"AM" 或 "PM",而在"ar-EG"中,"tt"是"ص" 或 "م"。当Format为null时,Culture会控制要使用的默认格式。当Culture为null或省略时,将使用Culture.Current。
要支持旧版工作流,options 和 culture 也可以是文本值。此行为与 options = [Format = options, Culture = culture] 相同。
Examples
Example #1
将 #time(01, 30, 25) 转换 为文本值。结果输出可能因当前区域性而异。
Time.ToText(#time(11, 56, 2))
Result:
"11:56 AM"
Example #2
使用自定义格式和德语区域性进行转换。
Time.ToText(#time(11, 56, 2), [Format="hh:mm", Culture="de-DE"])
Result:
"11:56"
Example #3
使用标准时间格式进行转换。
Time.ToText(#time(11, 56, 2), [Format="T", Culture="de-DE"])
Result:
"11:56:02"
Category
Time