-3

I want to get the correct time from this datetime string including the am and pm in python.

eg: 2017-04-11T10:34:50.472580Z.

I want it like this

Apr 11, 2017 4:04:50 PM

demongolem
  • 9,474
  • 36
  • 90
  • 105
spooky
  • 5
  • 2

1 Answers1

0

maybe you want to use something like :

date.strftime(format)

Return a string representing the date, controlled by an explicit format string. Format codes referring to hours, minutes or seconds will see 0 values. For a complete list of formatting directives, see section strftime() and strptime() Behavior.

date.__format__(format)

Same as date.strftime(). This makes it possible to specify a format string for a date object when using str.format(). See section strftime() and strptime() Behavior.

you will find more details and examples here :

https://docs.python.org/2/library/datetime.html

Dadep
  • 2,796
  • 5
  • 27
  • 40