or
Code Golf date-time
Mathgeek
The "Julian Date" is a different form of calendar-keeping than the Gregorian Calendar we're used to. Instead of categorizing by months, and each month by days, it categorizes the entire year into days - no months necessary.

February 11th is the 42st day of the year, for example.

Your goal is to take in a Julian Date 0<X<=365 and print the Gregorian Calendar equivalent (assuming it's not a leap year). Any output that indicates the month and day uniquely and unambiguously is acceptable. Below are some inputs and some example outputs.


Julian (IN)|Gregorian (OUT)|Format (Specify)
:--|:--|:--
10|January 10|MonthName Date
55|FEB 24|MTH DD
121|0501|MMDD
235|23/08|DD/MM
331|11-27|MM-DD
Top Answer
Adám
# [APL (Dyalog Extended)], 9 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") [^SBCS^](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")

Anonymous tacit prefix function returning `[M,D]`

```apl
2↑1↓⌂date
```

[Try it online!][TIO-k6hkmfg1]

`⌂date` returns a full `[1990,M,D,h,m,a,f]` date-time (1990 was not a leap year)

`1↓` drop the year

`2↑` take the month and day

[APL (Dyalog Extended)]: https://github.com/abrudz/dyalog-apl-extended
[TIO-k6hkmfg1]: https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/3@hR20TDR22TH/U0pSSWpP5Pe9Q24VFv36O@qZ7@j7qaD603BioA8oKDnIFkiIdn8P80BUMDrjQFU1MgYWhkCCSNjEFsY2NDAA "APL (Dyalog Extended) – Try It Online"
Answer #2
Skillmon
# LaTeX, 54 bytes

The function definition:

```tex
\def~#1{\setdatebynumber{#1}\thedatemonth-\thedateday}
```

Complete script:

```tex
\documentclass{article}
\usepackage{datenumber}
\def~#1{\setdatebynumber{#1}\thedatemonth-\thedateday}

\begin{document}
~{10}

~{55}

~{121}

~{235}

~{331}
\end{document}
```

Output (in PDF), format is M-D:

![cg_juliantogreg.png](/image?hash=fc05c263fd99705d3e8946afc75ac98c0381f6d4057197e4ed483beec3c70e76)

The `datenumber` package uses 1800 as the start year, which was no leap year.
Julian Dates
samcarter replying to Skillmon
... an IT professor located within this universe, so astronomy should cover it :)
Skillmon replying to Mathgeek
PGF was developed by an IT professor.... :)
Mathgeek
The point in general is moot regardless - since we're in the "computer science industry" by playing Code Gol here, so using the terminology in that field should be the standard ;P
samcarter replying to Skillmon
:) so everything important is covered (although personally I'd rather use MJD, makes the numbers much easier to handle)
Skillmon replying to samcarter
PGF uses this interpretation internally as well for date calculations :)
samcarter replying to Skillmon
The "other" understanding is not restricted to astronomy, but also used in other fields ![Screen Shot 2020-02-27 at 14.11.26.png](/image?hash=d7e478451e72962ec1e0f8bbfedc2f6716604170cd00f2747f03d209899b5618) https://books.google.de/books?id=4AdlCwAAQBAJ&pg=PT205&lpg=PT205&dq=financiers+modified+julian+date&source=bl&ots=7EYI4wYSTS&sig=ACfU3U20lfmcKQp4WP-BR9s9IjO-UwFymg&hl=en&sa=X&ved=2ahUKEwjf7vXW5vHnAhWIxMQBHZuhDQAQ6AEwCXoECAkQAQ#v=onepage&q&f=false
Mathgeek
It's interesting, because this question is the first time I've encountered the *other* understanding. As someone in a CS/business field, every calendar in the building has the ordinal Julian Date on it.
Skillmon replying to Mathgeek
This question was the first time I encountered this understanding, tbh. The other one I knew for quite some time now.
Mathgeek
it's interesting you say *they're* the edge case, when it literally says "outside of astronomy, this is the thing, especially in X fields". I'm pretty sure that's worded in an "astronomy is the exception" way.
Skillmon replying to Mathgeek
edge cases. I'd always associate "number of days since like forever ago" :)
Mathgeek
The [Wikipedia's "Julian Day: Terminology" section](https://en.wikipedia.org/wiki/Julian_day#Terminology) literally says;  
  
"The term Julian date may also refer, outside of astronomy, to the day-of-year number (more properly, the ordinal date) in the Gregorian calendar, especially in computer programming, the military and the food industry".
Skillmon
And I'm too dumb to actually know stuff better :) That should've been 4713BC for the Julian calendar, 4714BC in the Gregorian Calendar was right, though.
Skillmon
@Mathgeek your description of the Julian Date is wrong, the Julian Date is the number of days passed since the 1st January 4712BC. So 10 should be 11th January 4712BC, which equals the 4th December 4714BC in the Gregorian Calendar.
Mathgeek
Return is acceptable, but content that is not "part of the read output" is not allowed.
Adám
@Mathgeek print includes return per the unwritten default rules (which is why we need them in writing…), yes?
Adám
@Mathgeek Are we allowed to return too include additional (but constant) content in the response? E.g. always prefixing with "1234" and always suffixing with "abc def", so e.g. 331 → "1234 11 27 abc def"?