$ {time} =获取时间time = NOW + 1h 2min 3s#1h 2min 3s添加到本地时间

问题描述 投票:0回答:2

根据Get Time Keyword in BuiltIn Library in Robot

    ${time} =   Get Time    time=NOW + 1h 2min 3s   # 1h 2min 3s added to the local time

$ {time}不是YYYY-MM-DD hh:mm:ss格式,但具有以下值

${time} = 27

你能解释为什么吗?

robotframework built-in
2个回答
0
投票

在Robot Framework文档中,关键字Get Time提到了两个参数:

格式=时间戳,时间_ =现在

您可以说出您的示例缺少__ >>

*** Test Cases ***
Test Time
     ${time} =   Get Time    time_=NOW + 1h 2min 3s   # 1h 2min 3s added to the local time
     log to console    ${time}

导致:

INFO : ${time} = 2020-01-18 17:24:16

0
投票

如果您仔细阅读文档,则“ time”参数实际上被命名为time_而不是time(请注意尾随下划线)。由于您没有使用下划线,因此机器人会将“ time = NOW + 1h 2m 3s”解释为格式。

因为格式字符串(thinks

© www.soinside.com 2019 - 2024. All rights reserved.