0

I am writing a small python program. Here I am getting date in yyyy-mm-dd hh:mm:ss format (Time is in 24 hour format here Example: 2015-11-05 21:23:45). I have to convert it to this format mm/dd/yyyy hh:mm AM/PM

Example: 10/26/2015 4:00 AM

I tried many date libraries but could not find any. May I know how to do this?

sklearning
  • 223
  • 1
  • 4
  • 12

1 Answers1

1
import time
t = time.strftime("%m/%d/%Y %I:%M %p")
print(t)

Here's a link to more time formatting codes that may help.

Woodsy
  • 3,177
  • 2
  • 26
  • 50