如何在android sqlite中创建一个带有timestamp []值的列?(每个值都是一个数组)

时间:2021-11-13 01:02:31

i want to store a list of timestamps in android sqlite database.meaning each value in the column is a list of timestamp variables any ideas or other solution are accepted..

我想在android sqlite数据库中存储一个时间戳列表。意思是列中的每个值都是时间戳变量列表,任何想法或其他解决方案都被接受。

like :

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

1 个解决方案

#1


1  

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.

long timeStamp = 1456789985674L; //在数据库中保存时间戳(SQLite)String dataBaseValue = String.valueOf(timeStamp); //获取数据库中的时间戳(SQLite)timeStamp = Long.valueOf(dataBaseValue); // timeStamp可以根据要求使用。

#1


1  

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.

long timeStamp = 1456789985674L; //在数据库中保存时间戳(SQLite)String dataBaseValue = String.valueOf(timeStamp); //获取数据库中的时间戳(SQLite)timeStamp = Long.valueOf(dataBaseValue); // timeStamp可以根据要求使用。