Reputation: 1219
I store hour and minute in two separate column. i want to combine it like as hour:minute(9:15) and store timeunit(AM-PM) in separate column.how to do this can any one knows.hour and minute of String type.
Upvotes: 0
Views: 84
Reputation: 111
Try to store the time in one column use one of the following types.
SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:
Its easier to store the time in one INTEGER column in milliseconds. And recreate it by Date date = new Date(milliseconds)
. Then to get the hours and minutes from date
.
Upvotes: 2
Reputation: 4328
Try something like this
SELECT (column1 || ":" || column2) AS expr1 FROM your_table;
Upvotes: 1