So i have this kind f format:
'%Y-%m-%d %H:%M:%S.%f'
date_time = datetime.now()
Ouput
'2019-04-15 07:52:14.211697'
And i want to change is into this format: '%Y-%m-%d %H:%M:%S,%f'
This is what i have try:
time = datetime.strptime(str(date_time), '%Y-%m-%d %H:%M:%S,%f')
And this is the error:
ValueError: time data '2019-04-15 07:52:14.211697' does not match format '%Y-%m-%d %H:%M:%S,%f'
Edit
So i have this string:
maches = regex.findall(
'[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1]) (?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9],[0-9][0-9][0-9]',
line)
match[0] = '2019-03-13 17:35:35,855'
And i want to convert it to Datetime:
time = datetime.strptime(maches[0], '%Y-%m-%d %H:%M:%S,%f')
And this returned another format:
2019-03-13 17:35:35.855000
Why ?