Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
format with datetime solution in Clear category for Date and Time Converter by lxf42
import re
import datetime
def date_time(time: str) -> str:
dt = datetime.datetime.strptime(time, '%d.%m.%Y %H:%M')
outformat = "%-d %B %Y year %-H hours %-M minutes"
if dt.hour == 1:
outformat = outformat.replace('hours', 'hour')
if dt.minute == 1:
outformat = outformat.replace('minutes', 'minute')
return dt.strftime(outformat)
Feb. 20, 2022
Comments: