Python Date strftime() 方法
strftime() 方法
datetime 对象具有将日期对象格式化为可读字符串的方法。
该方法称为strftime(),并采用一个参数format来指定格式 返回的字符串:
实例
Display the name of the month:
import datetime
x = datetime.datetime(2018, 6, 1)
print(x.strftime("%B"))
亲自试一试 »
datetime 对象具有将日期对象格式化为可读字符串的方法。
该方法称为strftime(),并采用一个参数format来指定格式 返回的字符串:
Display the name of the month:
import datetime
x = datetime.datetime(2018, 6, 1)
print(x.strftime("%B"))
亲自试一试 »
