Do you really mean the Julian date, how do astronomers use it? Ordinal dates that are indicated as a year (four digits) and a day during that year (3 digits) are sometimes incorrectly called Julian dates.
static String formatOrdinal(int year, int day) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Calendar.DAY_OF_YEAR, day); Date date = cal.getTime(); SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); return formatter.format(date); }
This will give you a date at 00:00 local time; you may want to set the time zone in calendars to GMT instead, depending on the application.
erickson
source share