how to insert the date value in sqlite?

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

how to insert the date value in sqlite?

Postby androidbase » Fri Feb 05, 2010 1:04 pm

hey,

i am working on data manipulation using sqlite.

how can i insert the datetime value in sqlite

i implemented the below code in my app.

it works,

DateFormat formatter = new SimpleDateFormat("dd MMM yyyy hh:mm:ss");
String temp=property.getFirstChild().getNodeValue();
Date s=formatter.parse(temp.substring(5, temp.length()-5));
String pubdate= formatter.format(s);

but i cant sort by date :cry: :cry: :cry: :cry: :cry: :cry:

help help help :idea: :idea: :idea:
androidbase
Experienced Developer
Experienced Developer
 
Posts: 50
Joined: Sat Jan 16, 2010 1:41 pm

Top

Postby appforce » Sun Feb 07, 2010 10:31 pm

Hi,

Use Date.getTime() to get UNIX milliseconds time. It's great for storing in database, and for retrieve too - Date has a constructor that gets milliseconds.


Android developers
appforce
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Mon Nov 23, 2009 8:28 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Google Feedfetcher and 5 guests