SQLite查询的日期格式 [英] Date formatting from SQLite query

查看:88
本文介绍了SQLite查询的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从SQLite数据库中拉和格式化时间戳。在我的阅读中,与PHP可用的日期格式转换相比,SQLite格式化似乎非常有限。我有这个查询来自javascript:

I'm trying to pull and format timestamp from my SQLite db. In my reading, it seems that SQLite formatting is extremely limited compared to date formatting conversion available to PHP. I have this query coming from javascript:

SELECT strftime('%m%d,%Y',timestamp)AS saveddate

它返回:

03 03,2009

03 03, 2009

我试图让它返回:

2009年3月3日

任何建议?

推荐答案

SQLite 不支持月份名称,可悲的是。您将不得不使用查找表,案例陈述或表示层上的开关将其转换为月份名称。

SQLite does not support month names, sadly. You will have to convert it to a month name either using a lookup table, a case statement, or a switch on the presentation layer.

这篇关于SQLite查询的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆