import datetime now = datetime.datetime.now() # 获取当前日期和时间 print(now) date = datetime.date(2023, 8, 3) # 创建日期对象 print(date) time = datetime.time(12, 30, 0) # 创建时间对象 print(time) timestamp = datetime.datetime.timestamp(now) # 将日期时间对象转换为UNIX时间戳 print(timestamp)