# Next date with distinct digits

The date today is 7th June 2019, or 07/06/2019 (using the English DD/MM/YYYY ordering).

When is the next date that when written in this way has all eight digits different?

Rather remarkably, I wrote down this exact puzzle in my notebook a couple of years ago to which I think the answer is

17/06/2345 in DD/MM/YYYY format.

Reasoning

Notice that the first M will either be $$0$$ or $$1$$.
If it is $$0$$ then the first D will either be $$1$$ or $$2$$ or DD will be $$31$$.
If it is $$1$$ then either the second M will be $$0$$ or the second M will be $$2$$ and the day will contain a $$0$$.

Overall, this means that $$0$$ and either $$1$$ or $$2$$ must be used in the DD/MM part. If we don't want to skip to the next millenium, we need the $$2$$ for the beginning of the year.
Hence the DD/MM part requires both $$0$$ and $$1$$.
After that, we focus on the nearest year possible which comes from assigning the digits $$3,4,5$$ in order to century, decade and digit of the year.
It makes more sense to assign the $$0$$ to the month instead of $$1$$ but we cannot assign both since we cannot have a day without any of $$0$$, $$1$$ or $$2$$. Hence, we assign $$6$$ to the month and then $$7$$ to create the day.

• I can confirm that this is also the result of writing a dumb Python program to try future dates until it finds one satisfying the given condition. – Gareth McCaughan Jun 7 at 15:04
• Pleasingly (but also somewhat obviously) the two days following also satisfy the condition. – IanF1 Jun 16 at 21:06