Skip to content Skip to sidebar Skip to footer

Trying To Make A Custom Cursoradapter That Converts Unixtime Into Something Readable Before Putting In A Listview

I'm trying to make a custom CursorAdapter for something that I'm writing. The plan for what I'm doing involves an SQLite databases full of dates and times for an alarm to go off. (

Solution 1:

No need for a custom adapter. Make the database work for you.

From the docs:

" 1.2 Date and Time Datatype

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:

TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS"). REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar. INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.

Applications can chose to store dates and times in any of these formats and freely convert between formats using the built-in date and time functions."


Use the appropriate SQLite functions to convert your date/time before it goes into the cursor.

Post a Comment for "Trying To Make A Custom Cursoradapter That Converts Unixtime Into Something Readable Before Putting In A Listview"