Skip to content

Instantly share code, notes, and snippets.

@JamesHovious
Last active November 5, 2018 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesHovious/8126463 to your computer and use it in GitHub Desktop.
Save JamesHovious/8126463 to your computer and use it in GitHub Desktop.
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;
}
@FernandoBontorin
Copy link

useful

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