O
O
olexandr7772015-06-25 18:36:03
Java
olexandr777, 2015-06-25 18:36:03

Why doesn't Calendar setTimeInMillis work?

Here is the code:

Calendar c = Calendar.getInstance();
            Log.v("ddddd", c.getTime().toString());
            c.setTimeInMillis((System.currentTimeMillis() + 86400));
            Log.v("ddddd", c.getTime().toString());

Displays the previous date

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Emin, 2015-06-25
@olexandr777

Check again because everything is correct. For example, it displays different dates for me.

Thu Jun 25 21:04:29 AZST 2015
Thu Jun 25 21:05:55 AZST 2015

N
Nikita, 2015-06-26
@jkotkot

Don't suffer. Use JODA Time. There, all these operations are done much easier. and fewer errors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question