. clear all
. set obs 1
. gen var=20190417 // today's date in a custom format
. format var %10.0g // so the full number can be seen in the editor
. list

+----------+
| var |
|----------|

1. | 20190416 |
+----------+



I have fallen into this trap many times until I realised that Stata thinks 20190417 equals to 20190416 ...

These days I use gen long but still, this should not happen.

Any thoughts?