Last active
November 5, 2018 14:25
-
-
Save JamesHovious/8126463 to your computer and use it in GitHub Desktop.
Output the Julian Date in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
useful