Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Output the Julian Date in Java
private String jd(){
GregorianCalendar gc = new GregorianCalendar();
String year = new Integer(gc.get(GregorianCalendar.YEAR)).toString();
String jdPrefix = year.substring(3);
int jdSuffixInt = gc.get(GregorianCalendar.DAY_OF_YEAR);
String jdSuffix = String.format("%03d", jdSuffixInt);
String jd = jdPrefix + jdSuffix;
return jd;
Copy link

FernandoBontorin commented Nov 5, 2018


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment