Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second: bool for plural-s and f-string solution in Clear category for Date and Time Converter by leggewie
from time import strftime, strptime
def date_time(time: str) -> str:
x = strptime(time, "%d.%m.%Y %H:%M")
t1 = strftime("%-d %B %Y year %-H hour", x)
t2 = strftime("%-M minute", x)
s1 = "s"*(not x.tm_min == 1) # plural-s
s2 = "s"*(not x.tm_hour == 1) # plural-s
return f"{t1}{s1} {t2}{s2}"
June 3, 2021
Comments: