在python下面,如何从字符串转变成时间类型,时间类型如何转变成字符串呢?
count_date="2017-05-31"
import datetime,time
count_date_format = datetime.datetime.strptime(count_date,'%Y-%m-%d')
delta = datetime.timedelta(days=1)
count_date_nextday_format = count_date_format + delta
count_date_nextday = count_date_nextday_format.strftime('%Y-%m-%d')
print count_date_nextday
count_date_monthstart = str(count_date_format.year)+ "-" + str(count_date_format.month) + "-01"
print count_date_monthstart
count_date_yearstart = str(count_date_format.year)+ "-" + "01" + "-01"
print count_date_yearstart