Hi Marcus,

if I get you correctly, you want to display a date in a readable
format that comes from miiliseconds.

System.currentTimeMillis() returns a primitive long, so Date date =
new Date(System.currentTimeMillis()) will not work.

Try this:
long millis = System.currentTimeMillis();
Date date = new Date(millis);
Calendar c = Calendar.getInstance();
c.setTime(date);

System.out.println(millis + " ms correspond to mm-dd-yyyy" + c.get
(Calendar.MONTH) + "-" + c.get(Calendar.DATE) + "-" + c.get
(Calendar.YEAR));

Ciao,
  Tommaso

On 6 Mrz., 09:33, Marcus <[email protected]> wrote:
> Hi,
>
> as I understand, the internal date-format is the time in millis, since
> it is the format to store in sqlite and the format I get from
> System.currentTimeMillis().
>
> But how can I convert this back to a human readable format? Do I have
> to use new Date(int) and then use a SimpleDateFormat? Or is there any
> convinience method?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to