robot中先导入DateTime库
对时间操作的datetime库常用关键字:
1,获取当前时间戳
#获取当前时间
${time} get current date
#转化为原始时间戳
${time_stamp} convert date ${time} epoch
#转化为毫秒级时间戳
${time_stamp2} evaluate int(round(${time_stamp}*1000))
20200622 10:54:43.846 : INFO : ${time} = 2020-06-22 10:54:43.846
20200622 10:54:43.854 : INFO : ${time_stamp} = 1592794483.846
20200622 10:54:43.856 : INFO : ${time_stamp2} = 1592794483846
2,对固定日期进行操作,增加或减去单位时间或者时间段
3、对时间格式转化,获取时间戳
4、从完整时间中取指定年月日等