Selva
Selva

Reputation: 839

How to convert date format in sqlite?

I want to convert "13 Jul 2011 06:50:00 PM" to "2011/07/13 18:50", store it in an sqlite DB, and retrieve it with the reverse transformation. How could I do this? Please give me some example code.

Thanks in advance..

Upvotes: 0

Views: 407

Answers (1)

javisrk
javisrk

Reputation: 582

Use this:

SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd, HH:mm");
String dateString = formatter.format(new Date(date));

Upvotes: 2

Related Questions