0

I have date and time in this format [2020-07-25 | 03:01] in excel file .csv

How can I change it to this formal [2013-03-08 01:50:31] and extract the time from the data?

hijry
  • 1
  • 2
  • 1
    try this https://stackoverflow.com/questions/466345/converting-string-into-datetime – Dror Moyal Jul 26 '20 at 12:33
  • Could you provide some details about the context? how do you import the csv into Python? with what libraries? What did you try, what did not work? In principle, a simple `strptime` would be a start, e.g. `datetime.strptime('2020-07-25 | 03:01', '%Y-%m-%d | %H:%M')`. – FObersteiner Jul 26 '20 at 13:09

1 Answers1

0

Use this:


import time

t=time.strftime('%Y-%m-%d | %H:%M')
print(t)
Ujjwal Dash
  • 767
  • 1
  • 4
  • 8