跳到正文
本页目录

📜 获取系统信息 API

下面这些API提供了获取必要的系统信息的接口

获取当前时间字符串

system.getTimeStr()

  • 返回值:当前的时间字符串,使用当地时区和24小时制。
    形如2021-04-03 19:15:01
  • 返回值类型:String

获取当前的时间对象

system.getTimeObj()

  • 返回值:当前的时间对象(Object)

  • 返回值类型: Object<Integer,Integer,Integer,Integer,Integer,Integer,Integer>

  • 对于返回的某个时间对象 tm,有如下这些成员:

成员含义类型
tm.Y年份数值(4位)Integer
tm.M月份数值Integer
tm.D天数数值Integer
tm.h小时数值(24小时制)Integer
tm.m分钟数值Integer
tm.s秒数值Integer
tm.ms毫秒数值Integer

随机生成一个 GUID 字符串

system.randomGuid()

  • 返回值:一个随机生成的唯一标识符GUID
  • 返回值类型: String

随机生成一个 UUID 字符串

Warning

此函数仅在0.19.1及以后版本可用

system.randomUuid()

  • 返回值:一个随机生成的唯一标识符UUID
  • 返回值类型: String