Sqlite_Datetime列选择三月的行
In SQLite, use the strftime function to extract components from a date/time value
SELECT *
FROM table
WHERE strftime('%m', datemonth) = '03';
strftime(‘%m’, datemonth): extracts the month part from the datemonth column as a string (with leading zeros for single-digit months).
It is string from time.
strftime 方法按照 “%Y-%m-%d %H:%M:%S” 格式将日期和时间格式化为字符串并打印
strftime 是 python 的方法。
now = datetime.now() # current date and time
year = now.strftime("%Y")
print("year:", year)
year: 2020
strptime:
p表示parse,表示分析的意思,所以strptime是给定一个时间字符串和分析模式,返回一个时间对象。
strftime:
f表示format,表示格式化,和strptime正好相反,要求给一个时间对象和输出格式,返回一个时间字符串
https://www.runoob.com/python/att-time-strftime.html