faaclib.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:FCParser 作者: josecamachop 项目源码 文件源码
def load(self, raw_value):
        """Converts an input raw value into a timestamp.
        Returns: Datetime object, if the conversion succeeds;
                 None, if the conversion fails.

        raw_value -- The raw value, in string format (eg. '2014-12-20 15:01:02'),
                     or in milliseconds since Epoch  (eg. 1293581619000)
        """
        if isinstance(raw_value, str):
            try:
                timestamp = datetime.strptime(raw_value, "%Y-%m-%d %H:%M:%S")
            except:
                timestamp = None
        else:
            try:
                timestamp = datetime.utcfromtimestamp(float(raw_value)/1000)
            except:
                timestamp = None
        return timestamp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号