Jun-19-2023, 10:59 AM
L.S.,
I'm rather new to python-programming. I'm trying to remove the time info from a date time string read from a csv-file. My impression is that to achieve this, I have to use the strptime() function.
The test-script i'm using:
Who can help me with this issue?
Thanks in advance
I'm rather new to python-programming. I'm trying to remove the time info from a date time string read from a csv-file. My impression is that to achieve this, I have to use the strptime() function.
The test-script i'm using:
from datetime import datetime my_datetime ='2023-06-15 07:26:50' my_date = datetime.strptime(my_datetime, '%Y-%m-%d' ) print(my_date)The error message I get in line 4:
Error:File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_strptime.py", line 352, in _strptime
raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: 07:26:50
What I want to achieve is that 'my_date' contains the string '2023-06-15' without the time info of 'my_datetime'.Who can help me with this issue?
Thanks in advance