如何在sqlite中转换日期格式? [英] How to convert date format in sqlite?
本文介绍了如何在sqlite中转换日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将2011 年 7 月 13 日 06:50:00 PM"转换为2011/07/13 18:50",将其存储在 sqlite 数据库中,并通过反向转换检索它.我怎么能这样做?请给我一些示例代码.
I want to convert "13 Jul 2011 06:50:00 PM" to "2011/07/13 18:50", store it in an sqlite DB, and retrieve it with the reverse transformation. How could I do this? Please give me some example code.
提前致谢..
推荐答案
使用这个:
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd, HH:mm");
String dateString = formatter.format(new Date(date));
这篇关于如何在sqlite中转换日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文