Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to query in sqlite for different date format

Tags:

People also ask

How do I change the date format in SQLite?

Use the STRFTIME() function to format date\time\datetime data in SQLite. This function takes two arguments. The first argument is a format string containing the date/time part pattern. In our example, we use the format string '%d/%m/%Y, %H:%M'.

How do I find the difference between two dates in SQLite?

To calculate the difference between the timestamps in SQLite, use the JULIANDAY() function for both timestamps, then subtract one from the other. This way, you get the difference in days. The integer part of the difference is the number of full days, and the decimal part represents a partial day.

Does SQLite have date format?

The SQLite datetime function is a very powerful function that can calculate a date/time value, and return it in the format 'YYYY-MM-DD HH:MM:SS'.


I am using sqlite for local database in mobile and in my database, I have date field with column name RN_CREATE_DATE. My RN_CREATE_DATE column value is in this format 'dd-mm-yy HH:MM:SS' and I want to fetch data with given date. What will be the exact query for that I tried with below database column and value

**RN_CREATE_DATE

2012-07-27 11:04:34

2012-05-28 10:04:34
2012-07-22 09:04:34**

SELECT  RN_CREATE_DATE 
FROM DISPOSITION 
WHERE  RN_CREATE_DATE=strftime('%Y', '2012-07-28 12:04:34')

but no result found, just help me out with this.