Reputation: 11
I want to get which day of year is it. a year have 365 days . I want to get which day base on the data , i have . for example : my date is : 2017/01/03 ---> base on this data I found that it means day 2.
Upvotes: 0
Views: 49
Reputation: 12118
You can use Calendar class to get your desired output:
Calendar cal = Calendar.getInstance(); // get calendar object instance
cal.setTime("set your time here"); // set your desired time here, it can be as Date object, if you've millis then use setTimeInMillis();
cal.get(Calendar.DAY_OF_YEAR); // get day of year like this
Upvotes: 1