Sqlite_Datetime列选择三月的行

In SQLite, use the strftime function to extract components from a date/time value

sql 复制代码
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 的方法

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

相关推荐
鸿乃江边鸟3 天前
向量化和列式存储
大数据·sql·向量化
懒虫虫~3 天前
通过内存去重替换SQL中distinct,优化SQL查询效率
java·sql·慢sql治理
逛逛GitHub3 天前
1 个神级智能问数工具,刚开源就 1500 Star 了。
sql·github
Huhbbjs3 天前
SQL 核心概念与实践总结
开发语言·数据库·sql
咋吃都不胖lyh3 天前
SQL-字符串函数、数值函数、日期函数
sql
sensenlin913 天前
Mybatis中SQL全大写或全小写影响执行性能吗
数据库·sql·mybatis
王维志4 天前
LiteDB详解
数据库·后端·mongodb·sqlite·c#·json·database
xqlily4 天前
SQL 数据库简介
数据库·sql
森林-4 天前
MyBatis 从入门到精通(第三篇)—— 动态 SQL、关联查询与查询缓存
sql·缓存·mybatis