python时间

#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import time
import datetime


line="Wed 11/22/2017 11:18 PM"
timeValue=time.strptime("Wed 11/22/2017 11:18 PM","%a %m/%d/%Y %H:%M %p")
day = time.strftime('%Y-%m-%d',timeValue)
year = time.strftime('%Y',timeValue)
UTC_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
utcValue=time.strftime("%Y-%m-%dT%H:%M:%S.%fZ", timeValue)


print(utcValue) 

 

s=""
print("true" if (s.strip()=='') else "false")

  

m=datetime.datetime.utcfromtimestamp(time.mktime(time.strptime("Wed 11/22/2017 11:18 PM","%a %m/%d/%Y %H:%M %p")))

print(m)  

  

 

原文地址:https://www.cnblogs.com/panpanwelcome/p/7891567.html