1#!/usr/bin/python3 2from datetime import datetime, timezone 3from enum import Enum 4 5 6class TimeOfDay(Enum): 7 AM = 0 8 PM = 1 9 10 11def timestamp(date: str, time: TimeOfDay) -> int: 12 [year, month, day] = [int(x) for x in date.split("-")] 13 14 if time == TimeOfDay.AM: 15 [hour, minute, second] = [00, 00, 00] 16 else: 17 [hour, minute, second] = [23, 59, 59] 18 19 return int( 20 datetime( 21 year, month, day, hour, minute, second, tzinfo=timezone.utc 22 ).timestamp() 23 ) 24