Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
563 B
2
Indexable
def format_datetime(day, date, start_time):
    # Convert date string to a datetime object
    datetime_obj = datetime.strptime(date, "%B %d")
    
    # Get the abbreviated month name
    month = datetime_obj.strftime("%b.")
    
    # Format the time string to include AM/PM
    time_obj = datetime.strptime(start_time, "%H:%M")
    formatted_time = time_obj.strftime("%-I:%M%p").lower()
    
    # Format the final string
    formatted_datetime = f"{day}, {month} {datetime_obj.day}, {datetime_obj.year} at {formatted_time}"
    
    return formatted_datetime