Files
core/lib/doc/dever-time-operations.md
T
2026-11-03 03:32:07 +00:00

48 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 日期与时长
使用 UTC 日期时间和毫秒时长。
## dever.time.now
读取当前 UTC 日期时间,精度为毫秒。
## dever.time.parseDatetime
解析 RFC3339 和明确偏移,最多三位小数;拒绝闰秒及转换后超出四位 UTC 年份的值。
## dever.time.formatDatetime
输出 UTC YYYY-MM-DDTHH:MM:SS[.sss]Z;零毫秒省略小数。
## dever.time.parseDate
解析严格的 YYYY-MM-DD,验证实际日历日期。
## dever.time.formatDate
输出 YYYY-MM-DD,Date 表示 UTC 午夜毫秒。
## dever.time.parseTime
解析 HH:MM:SS 或 HH:MM:SS.sss;拒绝闰秒和无效钟点。
## dever.time.formatTime
输出 HH:MM:SS[.sss],零毫秒省略小数。
## dever.time.duration
构造有符号毫秒时长,保留完整 Int 范围。
## dever.time.add
相加并检查 i64 溢出;结果是否能格式化由格式化操作判断。
## dever.time.subtract
相减并检查 i64 溢出;结果是否能格式化由格式化操作判断。
## dever.time.difference
计算有符号毫秒差,溢出时传播 DurationResult.Failed。