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

相关推荐
张人玉28 分钟前
整合 Sugar ORM 连接 SQLite 数据库到 WPF 折线图项目
数据库·sqlite·c#·wpf
linweidong36 分钟前
hive sql行转列,列转行sql的实例
hive·hadoop·sql
只想早点退休的90后38 分钟前
sql面试题分享
数据库·sql
Apache Flink1 小时前
克服Flink SQL限制的混合API方法
大数据·sql·flink
Hello.Reader1 小时前
Flink SQL 性能调优MiniBatch、两阶段聚合、Distinct 拆分、MultiJoin 与 Delta Join 一文打通
sql·spring·flink
实泽有之,无泽虚之16 小时前
MySQL主机因多次连接数据库错误而被阻塞
数据库·sql·mysql
Knight_AL16 小时前
从自然语言到 SQL:为什么向量数据库是更好的选择
数据库·sql
amao998819 小时前
数据库原理与技术 - 3-7 视图和索引 View& Index
数据库·sql·oracle
柒.梧.20 小时前
从原理到实战:Spring AOP全解析
数据库·sql
山峰哥20 小时前
SQL优化中的索引策略与Explain分析实战
大数据·汇编·数据库·sql·编辑器