26
5
Challenge
Weirdly, this hasn't been done yet: output the current date.
Rules
The date format you should follow is as follows:
YYYY-MM-DD
Where the month and day should be padded by zeroes if they are less than 10.
For example, if the program is run on the 24th May 2017, it should output
2017-05-24
The date can either be always in UTC or in the local date.
You must handle leaps years. i.e. in leap years, February has 29 days but 28 days in a normal year.
Winning
Shortest code in bytes wins.
14Happy 10k rep ! – Rohan Jhunjhunwala – 2017-05-24T20:42:30.787
1And congrats on the fastest growing thread I´ve ever seen. :D – Titus – 2017-05-24T20:59:00.570
@Titus You should have seen Hello, World! :D – Beta Decay – 2017-05-24T21:00:21.083
... and in normal years February has 31 days of course – edc65 – 2017-05-24T21:05:08.083
@edc65 I should really have known that Feb is 29 days long on leap years :P – Beta Decay – 2017-05-24T21:21:58.660
Finally a golf where golfing languages cant perform – Sivaprasath Vadivel – 2017-05-25T06:04:35.260
RIP Python needing the word
datetime
twice – WhatsThePoint – 2017-05-25T08:38:44.280In TIO, if I use
p
in Ruby it surrounds the output in quotes, but the actual date is in the right format. Is this okay? – snail_ – 2017-05-25T12:32:18.287@snail_ Do you have a link to this? – Beta Decay – 2017-05-25T13:08:04.683
@BetaDecay here: https://tio.run/nexus/ruby#@1@gEJKZm6qXl1@uV1xSlFYC5Kiruqn//w8A
– snail_ – 2017-05-25T13:09:33.527@snail_ That's fine – Beta Decay – 2017-05-25T13:10:11.987
A codegolf challenge where practical languages can beat golfing languages? Amazing! – KSmarts – 2017-05-25T13:44:55.533
Surprised no one commented on this, but: that's not "ISO8601 date format". ISO8601 is a whole class of valid date formats, some of which are pretty whacky, like
-1432198
. – Steve Bennett – 2017-06-05T07:37:35.117@SteveBennett I see. I've edited accordingly – Beta Decay – 2017-06-05T08:01:39.467