

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# util.time 中的时间帮助程序
<a name="time-helpers-in-util-time-js"></a>

`util.time` 变量包含的日期时间方法有助于生成时间截，在不同的日期时间格式之间进行转换，并解析日期时间字符串。日期时间格式的语法基于该语法 [DateTimeFormatter](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html)，您可以参考该语法以获取更多文档。

## 时间实用程序列表
<a name="utility-helpers-in-time-list-js"></a>

 **`util.time.nowISO8601()`**  
以格式返回 UTC 的字符串表示[ISO8601形式](https://en.wikipedia.org/wiki/ISO_8601)。

 **`util.time.nowEpochSeconds()`**  
返回从 1970-01-01T00:00:00Z 纪元到现在的秒数。

 **`util.time.nowEpochMilliSeconds()`**  
返回从 1970-01-01T00:00:00Z 纪元到现在的毫秒数。

 **`util.time.nowFormatted(String)`**  
使用字符串输入类型指定的格式返回当前 UTC 时间戳的字符串。

 **`util.time.nowFormatted(String, String)`**  
使用字符串输入类型指定的格式和时区返回该时区当前时间戳的字符串。

 **`util.time.parseFormattedToEpochMilliSeconds(String, String)`**  
解析作为字符串传递的时间戳以及包含时区的格式，然后将时间戳作为自纪元以来的毫秒数返回。

 **`util.time.parseFormattedToEpochMilliSeconds(String, String, String)`**  
解析作为字符串传递的时间戳以及格式和时区，然后将时间戳作为自纪元以来的毫秒数返回。

 **`util.time.parseISO8601ToEpochMilliSeconds(String)`**  
解析作为字符串传递 ISO8601 的时间戳，然后返回自纪元以来的毫秒数的时间戳。

 **`util.time.epochMilliSecondsToSeconds(long)`**  
将纪元毫秒数时间戳转换为纪元秒数时间戳。

 **`util.time.epochMilliSecondsToISO8601(long)`**  
将纪元毫秒时间戳转换为时间戳。 ISO8601

 **`util.time.epochMilliSecondsToFormatted(long, String)`**  
将以长型形式传递的纪元毫秒数时间戳转换为根据提供的 UTC 格式设置的时间戳。

 **`util.time.epochMilliSecondsToFormatted(long, String, String)`**  
将以长型形式传递的纪元毫秒数时间戳转换为根据提供的时区和格式设置的时间戳。