简体   繁体   English

sqlite3时间戳列

[英]sqlite3 timestamp column

I feel stupid, but I can't get a TIMESTAMP column to be shown in human understandable way in a SELECT. 我觉得很愚蠢,但是我无法在SELECT中以人类可理解的方式显示TIMESTAMP列。

I could do that in MySQL, not in sqlite3. 我可以在MySQL中,而不是在sqlite3中。

Could someone show me an example please? 有人能告诉我一个例子吗?

Thanks 谢谢

Here is an example: 这是一个例子:

SELECT strftime('%Y', datetime(birthday_field, 'unixepoch', 'localtime'))
AS birthday_year 
FROM birthdays;

The following is a complete list of valid strftime() substitutions: 以下是有效strftime()替换的完整列表:

%d      day of month: 00
%f      fractional seconds: SS.SSS
%H      hour: 00-24
%j      day of year: 001-366
%J      Julian day number
%m      month: 01-12
%M      minute: 00-59
%s      seconds since 1970-01-01
%S      seconds: 00-59
%w      day of week 0-6 with sunday==0
%W      week of year: 00-53
%Y      year: 0000-9999
%%      % 

SELECT datetime(timestamp,'unixepoch','localtime');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM