RobotFramework:如何将日期从一位数的天数转换为丢失前导零

RobotFramework:如何将日期从一位数的天数转换为丢失前导零,robotframework,date-format,Robotframework,Date Format,见下文。通过检查dateformats,%d应该可以工作,但似乎无法工作-请参阅输出 Log to console Completion Date ${completion_date} ${date_to_search_for}= Convert Date ${completion_date} date_format=%Y-%m-%d %H:%m:%S.%f result_format=%d %b %Y 00:00:00 exclude_millis=True Log to cons

见下文。通过检查dateformats,%d应该可以工作,但似乎无法工作-请参阅输出

Log to console  Completion Date ${completion_date}
${date_to_search_for}=  Convert Date  ${completion_date}  date_format=%Y-%m-%d %H:%m:%S.%f  result_format=%d %b %Y 00:00:00  exclude_millis=True
Log to console  Completion Date ${date_to_search_for}
${completion_date}的输出

Completion Date 2017-07-01 08:37:13.656083
${date\u to\u search\u for}的输出

Completion Date 01 Jul 2017 00:00:00

从文档中我可以看出,
%d
的工作原理与a文档中的示例完全相同

要获得您想要的效果,请查看以下示例:

${datetime} =   Convert Date    2014-06-11 10:07:42.123 datetime
Should Be Equal As Integers    ${datetime.year}      2014   
Should Be Equal As Integers    ${datetime.month}         6  
Should Be Equal As Integers    ${datetime.day}           11 
Should Be Equal As Integers    ${datetime.hour}      10 
Should Be Equal As Integers    ${datetime.minute}        7  
Should Be Equal As Integers    ${datetime.second}        42 
Should Be Equal As Integers    ${datetime.microsecond}  123000