My question is,
What is the best way to store date/time in an SQL database on android so that the date and time can later be used for sorting the items that are getting added to the list?
My question is,
What is the best way to store date/time in an SQL database on android so that the date and time can later be used for sorting the items that are getting added to the list?
To easily get and store timestamp, you can use:
long time = System.currentTimeMillis();
"It is the standard 'wall' clock (time and date) expressing milliseconds since the epoch. The wall clock can be set by the user or the phone network" See more here: Android Developers
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
Date mDate = new Date();
insert in database will be dateFormat.format(mDate)