-1

I want to insert date in below format in sqlite through android:

11 Oct 2012 15:40

Please help me how to achieve this??

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
Ankit HTech
  • 1,863
  • 6
  • 31
  • 42
  • check this http://stackoverflow.com/questions/1933720/how-do-i-insert-datetime-value-into-a-sqlite-database it may help you – G_S Oct 11 '12 at 04:12
  • What is even the datatype in schema you want to insert to? if it's a datetime, that format will have to be specified to the query engine, if it's varchar then I guess you are free to store whatever you want :) – Greg Giacovelli Oct 11 '12 at 04:28
  • Thanks for your help I have resolved it with this SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy HH:mm"); – Ankit HTech Oct 11 '12 at 04:42

1 Answers1

1

use this code

SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy HH:mm");
// date is Object of Date class of java.util
String s = formatter.format(date);
// now you can save 's' to the sqlite. 
Jignesh Ansodariya
  • 12,583
  • 24
  • 81
  • 113