Format Date with Python
Posted: Fri Sep 23, 2022 3:50 pm
Hello,
I am having struggle with Python in RoboTask and formatting a date.
With method strftime() I want to get the day and month of the actual date as a decimal number.
The code ist: %-d and %-m.
With the following code in RoboTask I get an error:
I already installed Version 3.10.7 of Python and added the path to this python interpreter in RoboTask but the result is still the same.
Am I missing something?
I am having struggle with Python in RoboTask and formatting a date.
With method strftime() I want to get the day and month of the actual date as a decimal number.
The code ist: %-d and %-m.
With the following code in RoboTask I get an error:
Code: Select all
from datetime import datetime
print(datetime.today().strftime('%Y,%-m,%-d'))
[STDOUT] Traceback (most recent call last):
[STDOUT] File "C:\Users\robotask\AppData\Local\Temp\2\0zc6oojxecVi9TfbiuwVJVBJ47EVMAUT.py", line 3, in <module>
[STDOUT] print(datetime.today().strftime('%Y,%-m,%-d'))
[STDOUT] ValueError: Invalid format string
Exit code: 1
Am I missing something?