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

相关推荐
杨云龙UP14 小时前
【MySQL逻辑备份】基于mysqldump的MySQL 8.0全量逻辑备份脚本
linux·运维·数据库·sql·mysql·mssql
ptc学习者16 小时前
oracle 列的直方图
数据库·sql·mysql
驾数者16 小时前
DDL实战指南:如何定义和管理动态表
大数据·sql·flink
不知更鸟20 小时前
Django 的配置文件 INSTALLED_APPS
数据库·sqlite
wind_one121 小时前
13.基础--SQL--DQL-聚合函数
数据库·sql
面向星辰1 天前
SQL LIKE 相似信息查找语句
数据库·sql
不知更鸟1 天前
Django 项目是什么
数据库·sqlite
TangDuoduo00051 天前
【SQLite3 C语言接口】
数据库·sqlite
颜如玉2 天前
动态拼接SQL实践备忘📝
java·sql·mybatis
百***97642 天前
LangChain-08 Query SQL DB 通过GPT自动查询SQL
数据库·sql·langchain