Pleroma chat client in PyQt5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
plchat/timeconvert.py

15 lines
491 B

from dateutil.parser import *
from dateutil.tz import *
from datetime import *
def utc_to_local(utc, twofourhr=False):
if twofourhr:
clockfmt = '%H:%M'
else:
clockfmt = '%I:%M%p'
time = parse(utc)
local = time.astimezone(tzlocal())
today = datetime.today()
if local.day == today.day and local.month == today.month and local.year == today.year:
return datetime.strftime(local, '%I:%M%p')
return datetime.strftime(local, '%I:%M%p %m-%d-%y')