如何将'Apr 21, 2021, 7:43:51 AM GMT+5:30'解析为时间戳?

How to parse 'Apr 21, 2021, 7:43:51 AM GMT+5:30' into timestamp?

有像 'Apr 21, 2021, 7:43:51 AM GMT+5:30' 这样的日期字符串(从 google 电子表格下载到 CSV)。

这些日期格式是什么? 如何将它们解析成时间戳?

更新

我有一个功能:

def to_timestamp(s):
    datetime_object = datetime.strptime(s, '%b %d, %Y, %I:%M:%S %p')
    return datetime_object.timestamp()

但我不知道如何处理GMT+5:30

修补时区格式:

import re

def to_timestamp(s):
    s = re.sub(r'([+-])(\d{1}):', '\g<1>0\g<2>:', s)
    datetime_object = datetime.strptime(s, '%b %d, %Y, %I:%M:%S %p %Z%z')
    return datetime_object.timestamp()

s = 'Apr 21, 2021, 7:43:51 AM GMT+5:30'
d = to_timestamp(s)
>>> d
1618971231.0