How to get date value from SQLite in java -


i have simple table in database:

create table [informacjezdziekanatu] (   [_id] integer not null primary key autoincrement,    [datawstawienia] date not null,    [datamodyfikacji] date not null,    [tresc] varchar2 not null); 

in application want value of datawstawienia column. using such method:

try {     resultset result = stat.executequery("select * informacjezdziekanatu order _id desc limit 5");     int id;     date datawst;     date datamod;     string tresc;                     for(int j = 0 ; j < 5 ; j++) {             result.next();             object[] lista = new object[4];             id = result.getint("_id");             datawst = result.getdate("datawstawienia");             datamod = result.getdate("datamodyfikacji");             tresc = result.getstring("tresc");             lista[0] = id;             lista[1] = datawst;             lista[2] = datamod;             lista[3] = tresc;             dane[j] = lista;      } } 

all dates in datawstawienia column today's dates using method above 1970-01-01 date time.

what did wrong?

sqlite not have date data type. dates need either stored integers (number of seconds since unix epoch common) or iso 8601 times (e.g. 2013-10-01t12:12:12). if date in sqlite schema store values strings. solution of changing type of datewst string acknowledges fact storing dates strings , not internal date type.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -