There is another way.. and read/write date as milliseconds from/to the
database. Here are the methods to work with that value:

Date date = new Date(); //or new Date(long millis);
date.setTime(millis); //for now, use: System.currentTimeMillis()
int millis = date.getTime();

DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); //or
MEDIUM..
formattedDate = df.format(date);
date = df.parse(formattedDate);

I find this to be the right way.. since millis are an absolute value
by convention, and are not language/local dependent.

Regards

On 19 мај, 09:21, Markus <rookee1...@googlemail.com> wrote:
> Hello,
>
> I start to developed a SQLite based Android application. So I insert
> some test data so see how android and sqlite work. But when I get the
> data from the Cursor Object, there is not getter for a Date or
> Timestamp field.
>
> The only way is to get String and parse this with SimpleDateFormat,
> but thats not realy nice...
>
> Anybody an idea how I get the Date/Timestamp direct from the Cursor
> Object?
>
> Thanks for help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to