SQLite 日期 & 时间
日期时间函数:date()、time()、datetime()、strftime()、julianday();strftime 自定义格式输出。
Key PointsSQLite,日期时间,date,datetime,strftime
讲解
日期时间函数:date()、time()、datetime()、strftime()、julianday();strftime 自定义格式输出。
示例
SQL
SELECT date('now'), datetime('now'), strftime('%Y-%m-%d', 'now');
SELECT date('now', '+7 day') AS next_week;
SELECT strftime('%s', 'now') AS unix_ts;Output
2026-10-31|2026-10-31 14:30:00|2026-10-31讲解
日期时间函数:date()、time()、datetime()、strftime()、julianday();strftime 自定义格式输出。
示例
SQL
SELECT date('now'), datetime('now'), strftime('%Y-%m-%d', 'now');
SELECT date('now', '+7 day') AS next_week;
SELECT strftime('%s', 'now') AS unix_ts;Output
2026-10-31|2026-10-31 14:30:00|2026-10-31