Reputation: 304
I have date in new Date() format. I need to convert to SQLite date time format.(2014-01-05T00:00:00.000Z). Is it possible to do so??
var date = new Date();
now I need to convert this date to SQLite datetime format like (2014-01-05T00:00:00.000Z).
Upvotes: 4
Views: 10601
Reputation: 3890
Use this
// Create an instance of the Date class
var date = new Date();
// Convert it to an ISO string
var sqliteDate = Date.toISOString();
take a look at this W3schools
Upvotes: 4
Reputation: 330
Try:
var date = new Date();
var sqllite_date = date.toISOString();
Upvotes: 15
Reputation: 6252
You can use strftime, from date and time functions.
SELECT strftime('%d-%m-%Y', 'now')
Output
10-06-2010
Hope this helps ..:)
Upvotes: -2