Skip to content
Advertisement

how to serialize an object into and save it to mysql database? [closed]

i want to store a list of timestamps in android sqlite database.

like :

CREATE TABLE NOTEBOOK(
TITLES VARCHAR(50),
PHONE_NUMBERS INTEGER(11),
LIST_OF_RELATED_DATES TIMESTAMP[50]
)

Advertisement

Answer

Yes – simply text type column can be used to store timestamp. Once it will retrieve from the database it can parse in long type as required. For example:

long timeStamp = 1456789985674L; //To save timestamp in database(SQLite) String dataBaseValue = String.valueOf(timeStamp); //To fetch timestamp in database(SQLite) timeStamp = Long.valueOf(dataBaseValue); //timeStamp can be used as per requirements.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement