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')