7
1
Given a date between 2010-01-01 and 2099-12-31 as three integers (please state your order if not [year,month,day]
), answer with Tesco's corresponding five-digit Burger Relish Best Before End date number.
The format is simply the last two digits of the year, followed immediately by three digits representing the day of that year, between 000 and 365.
Cookies if you can do this using only numeric operations and comparisons. You may put such code separately from your golfed code, if it isn't also the shortest code you have.
Test cases
[year,month,day]
→ BRBBED
:
[2010,1,1]
→ 10000
[2019,7,5]
→ 19185
[2020,5,20]
→ 20140
[2096,12,31]
→ 96365
[2099,12,31]
→ 99364
"Cookies if you can do this using only numeric operations." Good luck handling dates without e.g. comparison operators... – Erik the Outgolfer – 2019-07-05T16:08:33.783
1@EriktheOutgolfer Addressed. – Adám – 2019-07-05T16:11:33.723
Closely related – Arnauld – 2019-07-05T16:22:09.830
2@Arnauld But that's a do-X-without-Y with an input domain that makes things harder. – Adám – 2019-07-05T16:33:35.093
Oh indeed. I missed that rule in the linked challenge. – Arnauld – 2019-07-05T16:38:14.980
Huh, I always wondered how that number translates to a date – Beta Decay – 2019-07-05T20:27:51.277
Must our output use 0-indexing for the days of the year or may we choose 1-indexing instead? – Shaggy – 2019-07-05T22:28:27.093
@Adám It's on many other products; not just this one! Why is the title so specific? – wizzwizz4 – 2019-07-06T15:16:35.763
1
@wizzwizz4 It was in the news recently: https://www.independent.co.uk/life-style/tesco-expiry-date-20140-julian-calendar-relish-twitter-a8973931.html : The supermarket’s unusual labelling choice came to light on Sunday after customer Matthew Stock shared a photograph on Twitter featuring a burger relish that had an expiration date of “20140” and asked Tesco to “please explain” it.
– seventyeightist – 2019-07-06T19:41:28.943@seventyeightist Oh. I thought it was one of those elitist things, and felt so pleased with myself for figuring it out after only 5 weeks and setting my laptop's clock to show the date. – wizzwizz4 – 2019-07-06T20:56:58.623
@Shaggy It has to be that silly format. – Adám – 2019-07-06T23:33:33.463