You can format the date in Python using the strftime() method. Here's an example:

import datetime

date_str = '2023-05-05T19:47:05.192394+05:30'
date_obj = datetime.datetime.fromisoformat(date_str)

formatted_date = date_obj.strftime('%d %B %Y')
print(formatted_date)

Output:

05 May 2023

Explanation:

  • The fromisoformat() method is used to convert the date string to a datetime object.
  • The strftime() method is used to format the datetime object into the desired format, which is '%d %B %Y' in this case. %d represents the day of the month, %B represents the full month name, and %Y represents the year in four digits
2023-05-05T194705192394+0530 format date in python 5th May 2023

原文地址: https://www.cveoy.top/t/topic/eC9D 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录