How to convert time in milliseconds to day in Java

1 Answer

0 votes
package javaapplication1;

import java.util.Calendar;

public class JavaApplication1 {

    public static void main(String[] args) {

        Calendar cal = Calendar.getInstance();
                           
        // Set time in milliseconds
        cal.setTimeInMillis(1476961706913L);
        
        int day = cal.get(Calendar.DAY_OF_MONTH);
        System.out.println(day);
    }
}

/*

run:

20

*/

 



answered Oct 20, 2016 by avibootz

Related questions

2 answers 268 views
1 answer 149 views
1 answer 147 views
2 answers 752 views
1 answer 120 views
...