Sqlite : Comparing timestamp value stored in a column to current Date

I store information in a sqlite database table as follows: ActionDate column is of type : DEFAULT CURRENT_TIMESTAMP

    private String getDateTime() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:ss", Locale.getDefault());
        Date date = new Date();
        return dateFormat.format(date);

I want to write an SQL query that returns all rows in my table having ActionDate value as today's date from sqlite DB. However as ActionDate is of type timestamp what is the most appropriate way to convert it to todays date.


If you want current date then use the following query :

 SELECT date('now');

To get all columns in your table having ActionDate equal to todays date use the below query :

select * from table where strftime('%Y-%m-%d ', datetime(ActionDate, 'unixepoch'))  = date('now)' ;

more info on SQLite Date & Time queries can be found here

Need Your Help

android mobile app + micorosoft health-vault?

android health-monitoring healthvault

Any help/tutorial for a simple android mobile application that sends some values to health-vault.

exponentiation RSA

c++ rsa

I am trying to implement RSA in C++ for extremely large numbers. I am not using any library. I wanted to write my own code :) So I have used strings to store these large numbers. Multiplication and

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.