Format date in websql

2019-08-07 13:28发布

问题:

I am using websql, but problem is, not finding any date functions in websql. I have date stored in the format Mon Apr 09 2012 15:23:54 GMT+530(India Standard Time), and I want the query result in the format 04/09/2012. Can any body help please?

回答1:

WebSql has a strftime function that should do what you need:

select strftime('%d-%m-%Y', 'now') formattedDate

As noted in the comment below, the data in the column will need to be a valid date time string recognized by SQLite. Check the SQLite Date Functions documentation for more info.



标签: web-sql