Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
datetime object
#1
I am getting a date like '20200402130324.9500+0530' . How can I convert this to python datatime object ?
Reply
#2
Use datetime.datetime.strptime and look for the strptime-behavior.

There is everything what you need. The +0530 is the timezone offset. +5 Hours, +30 minutes.
Let me guess: IST Indian Standard Time

If you need something to handle timezones, look for pendulum.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Review my code: convert a HTTP date header to a datetime object stevendaprano 1 1,914 Dec-17-2022, 12:24 AM
Last Post: snippsat
  TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str' findbikash 2 9,515 Sep-18-2019, 08:32 AM
Last Post: buran
  Convert from datetime to time.struct_time object chris0147 0 4,319 Mar-11-2018, 12:01 AM
Last Post: chris0147
  Convert String to Datetime Object tkj80 2 33,698 Apr-20-2017, 08:45 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020