Search code examples
robotframework

How can I extract just YYYY-MM-DD from the retrieved variable?


If I have:

${time} = OperatingSystem.Get Modified Time @{Files}[${i}]
${onlyDate} = ???

How can I easily just get the YYYY-MM-DD from ${time} instead of YYYY-MM-DD HH:MM:SS?


Solution

  • you can try this with DateTime Library : ${date} = Convert Date ${date} result_format=%Y-m%-d% Refer more at - https://robotframework.org/robotframework/latest/libraries/DateTime.html#Date%20formats