Date Add & Subtract in SQlite
Date Add & Subtract in SQlite
// using System.Data.SQLite; try { SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + BrowserURL + @"\data.sqlite" + ";Version=3;New=True;Compress=True;"); SQLiteCommand sqlite_command = sqlite_connection.CreateCommand(); sqlite_connection.Open(); sqlite_command.CommandText = "SELECT date('now','-6 day');"; //To subtract date object obj = sqlite_command.ExecuteScalar(); Console.Write(obj.ToString()); sqlite_command.CommandText = "SELECT date('now','+6 day');"; //To Add date obj = sqlite_command.ExecuteScalar(); Console.Write(obj.ToString()); sqlite_connection.Close(); } catch (Exception ex) { return null; }
Rate this solution
If you think this solution is useful — rate it up! Or dump it otherwise.
page revision: 0, last edited: 04 Dec 2009 11:42





