Robotframework 如何以法语打印日期,如下所示:2019年3月29日星期五22:53:00

Robotframework 如何以法语打印日期,如下所示:2019年3月29日星期五22:53:00,robotframework,Robotframework,我想按如下方式打印日期(2019年3月29日22:53:00),但结果如下(2019年3月29日22:53) v是微小的,在v后面有一个点 我使用以下代码获取法语日期 Evaluate locale.setlocale(locale.LC_ALL, 'French') locale 这是我用于格式化的语法: ${startDate} = Get Current Date result_format =a% d% b% Y% %H:%M 将字符串一分为二-第一个单词和其

我想按如下方式打印日期
(2019年3月29日22:53:00)
,但结果如下
(2019年3月29日22:53)
v是微小的,在v后面有一个点

我使用以下代码获取法语日期

Evaluate    locale.setlocale(locale.LC_ALL, 'French')    locale
这是我用于格式化的语法:

${startDate} =    Get Current Date 


result_format =a% d% b% Y% %H:%M

将字符串一分为二-第一个单词和其余单词,使用with
max_Split
等于1:

${splited}=    Split String     ${your date string}    max_split=1
点字符,并在拆分的第一个成员上使用方法将第一个字母大写:

${first}=    Remove String    ${splited[0]}    .
${first}=    Evaluate    "${first}".title()
${result}=    Catenate    ${first}    ${splited[1]}
# alternatively Set Variable will also do for a simple case like this
${result}=    Set Variable    ${first} ${splited[1]}
现在将标题大小写的单词与拆分的剩余部分结合起来:

${first}=    Remove String    ${splited[0]}    .
${first}=    Evaluate    "${first}".title()
${result}=    Catenate    ${first}    ${splited[1]}
# alternatively Set Variable will also do for a simple case like this
${result}=    Set Variable    ${first} ${splited[1]}
顺便说一句,我看到您的日期字符串中也需要秒,在这种情况下,格式模式应该是这样的:

%a d% b% Y% %H:%M:%S

将字符串一分为二-第一个单词和其余单词,使用with
max_Split
等于1:

${splited}=    Split String     ${your date string}    max_split=1
点字符,并在拆分的第一个成员上使用方法将第一个字母大写:

${first}=    Remove String    ${splited[0]}    .
${first}=    Evaluate    "${first}".title()
${result}=    Catenate    ${first}    ${splited[1]}
# alternatively Set Variable will also do for a simple case like this
${result}=    Set Variable    ${first} ${splited[1]}
现在将标题大小写的单词与拆分的剩余部分结合起来:

${first}=    Remove String    ${splited[0]}    .
${first}=    Evaluate    "${first}".title()
${result}=    Catenate    ${first}    ${splited[1]}
# alternatively Set Variable will also do for a simple case like this
${result}=    Set Variable    ${first} ${splited[1]}
顺便说一句,我看到您的日期字符串中也需要秒,在这种情况下,格式模式应该是这样的:

%a d% b% Y% %H:%M:%S