Skip to content

GetTime

返回输入时间的UNIX时间戳。

业务属性

属性含义说明输入限定示例值
enable是否启用该控件,未启用时不编译是否编译选择值启用
name控件返回值命名控件输出值变量名常量GetTime
text与控件关联的文本设计页控件显示常量GetTime
date时间常量/流程变量#{date}

目前仅支持以下四种时间格式:

  • yyyyMMdd
  • yyyy-MM-dd
  • yyyyMMddHHmmss
  • yyyy-MM-dd HH:mm:ss

不符合以上格式的时间都将抛出illegal date format异常。

使用示例

输入常量

时间输入:2023-11-11 11:11:11

img_6.png

输出控件返回getTimedata属性为:

json
{
  "getTime": "#{getTime}"
}
{
  "getTime": "#{getTime}"
}
img_7.png

使用curl请求接口:

$ curl http://localhost:6636/api/getTime
$ curl http://localhost:6636/api/getTime

接口返回:

json
{
    "getTime": 1699672271
}
{
    "getTime": 1699672271
}

输入指定变量

时间输入:#{body.time}

img_8.png

使用curl请求接口:

$ curl http://localhost:6636/api/getTime -d "{ \"time\": \"2023-11-11 11:11:11\" }"
$ curl http://localhost:6636/api/getTime -d "{ \"time\": \"2023-11-11 11:11:11\" }"

接口返回:

json
{
    "getTime": 1699672271
}
{
    "getTime": 1699672271
}