Code Golf
date-time add tag
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 LaTeX
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.
Answer #2 APL (Dyalog Extended)
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"

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.