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

相关推荐
要开心吖ZSH3 小时前
MySQL 慢 SQL 排查操作手册-个人笔记版
java·笔记·sql·mysql·慢查询
oradh5 小时前
Oracle固定执行计划的方法---SQL Plan Baseline
数据库·sql·oracle
jnrjian8 小时前
PG dblink 可以借用fdw 名字和密码直接访问
sql
2601_9603563810 小时前
2027零售商品计划岗能力拆解:统计学、SQL、Excel与业务指标怎么结合
sql·excel·零售
好奇的菜鸟10 小时前
GORM 入门(二):从 database/sql 平滑过渡到 GORM
数据库·sql
这个DBA有点耶11 小时前
关系数据库管理系统选型指南:四步决策框架与主流产品技术路线对比
数据库·sql·程序人生·mysql·database·dba
jason.zeng@150220711 小时前
(七)「固化 Rest 接口 + Text-to-SQL 灵活查询」双模式 Agent 架构教程
数据库·python·sql·ai·架构·langchain·ai编程
2501_9336707912 小时前
2027届数据类专业投用户增长岗:A/B实验、指标和SQL准备思路
数据库·sql
天空鸟_时光不老15 小时前
10-Agent安全隐患与SQL执行层加固
java·数据库·人工智能·sql·spring·maven·mybatis
格数致用1 天前
04- 电子表格数据持久化与SQLite数据库交互实战
sqlite·电子表格