It is common to start countdowns 100 days prior to an event, probably because of our base 10 system. Examples of this can be found everywhere:

  • 100 days until your birthday
  • 100 days until the wedding
  • 100 days until the election
  • 100 days until our graduation
  • 100 days until her due date
  • 100 days until football season
  • 100 days until you get the Fanatic badge

You get the picture. It seems that the 100th day before an event is second place only to the actual event. So for this challenge, I need to know what the date will be in 100 days, so that I can determine what I should start counting down too.

Input

No input

Output

The date 100 days from the current date based on the standard Gregorian Calendar (Make sure to account for leap years). Output is flexible as long as the date format is human read-able (eg 2016-10-8, 10-8-16, [ 2016, 10, 8 ]).

Winning

Code golf: shortest code in bytes


Examples

100 days from today (Apr 5th, 2017) is Friday, July 14 2017.

Current                Future
-------                ------
01/01/2001 +100        04/11/2001
01/01/2004 +100        04/10/2004
01/01/1900 +100        04/11/1900
01/01/2000 +100        04/10/2000

07/04/2017 +100        10/12/2017
10/31/2017 +100        02/08/2018
12/25/2017 +100        04/04/2018

08/29/1941 +100        12/07/1941
06/03/2001 +100        09/11/2001
share|improve this question
1  
Can I add the current time to the output? – Titus 3 hours ago

10 Answers 10

Bash, 17 16 15 14 13 bytes

date -d100day

It turns out the date command takes some pretty flexible input for relative timings. You can also do things like 1 year, 1 week ago, yesterday, etc. It's pretty cool.

-1 byte by realizing that bash does not care about grammar.
-1 byte because the space between 100 and day is unnecessary.
-1 byte because I don't need quotes anymore because I don't have a space in the string.
-1 byte by removing the space after -d (thanks ASCII-only!)

share|improve this answer
    
New favorite command +1 – NonlinearFruit 5 hours ago
    
@NonlinearFruit Hah, yeah, it's probably one of my favorite commands. Thanks! – HyperNeutrino 5 hours ago
    
You don't need the space after -d – ASCII-only 4 hours ago
    
@ASCII-only Oh, okay. Thanks! – HyperNeutrino 4 hours ago

Excel, 10

=NOW()+100

(Body must be at least 30 characters)

share|improve this answer

JavaScript, 42 bytes

(d=new Date()).setDate(d.getDate()+100)&&d

setInterval(_=>document.body.innerHTML=(d=new Date()).setDate(d.getDate()+100)&&d,1000)

share|improve this answer

Python, 63 bytes

from datetime import*
print(datetime.now()+timedelta(days=100))

Very simple solution really. Because the datetime.now() result is the same type as the result of timedelta, it happily adds the two together.

share
    
It doesn't have to be a function. You could remove the lambda: and it would still be a full program. – NonlinearFruit 4 hours ago
    
@NonlinearFruit Yes but print would have to be added and that makes it the same number of bytes. – user67196 4 hours ago

C#, 103 bytes

using System;class P{static void Main(){Console.Write(DateTime.Now.AddDays(100).ToShortDateString());}}

Full program which reads the current date, adds 100 days and displays the result in M/d/YYYY format.

You can change the date format by adding a few more bytes (one byte in the following):

using System;class P{static void Main(){Console.Write(DateTime.Now.AddDays(100).ToString("d-M-yyyy"));}}

To eliminate boilerplate code - C# isn't exactly known to be very compact - an anonymous function can be used:

C# lambda, 49 bytes

()=>DateTime.Now.AddDays(100).ToShortDateString()

Full program:

using System;

class P
{
    static void Main()
    {
        Func<string> f = 
        ()=>DateTime.Now.AddDays(100).ToShortDateString();

        Console.WriteLine(f());
    }
}
share|improve this answer
    
For the full program I think you can write System.DateTime.Now... to avoid "using System;" – Taemyr 8 mins ago

Mathematica, 26 bytes

Today+Quantity[100,"Days"]

If including the time is permitted, then we can save 2 bytes:

Now+Quantity[100,"Days"]
share|improve this answer

PHP, 28 bytes

<?=date(Y_m_d,time()+864e4);

human readable version, 35 bytes:

<?=date(Y_m_d,strtotime("100day"));

almost readable, 34 bytes:

<?=date(Y_m_d,strtotime(1e2.day));

-4 bytes if also printing the time is accepted: replace Y_m_d with r or c.

It´s National Holiday in France in 100 days.

share|improve this answer

IBM/Lotus Notes Formula, 29 bytes

@Adjust(@Today;0;0;100;0;0;0)

Unfortunately @Adjust requires the trailing 0's for the missing hh:mm:ss.

If we were allowed to display the time as well then changing @Today to @Now would save 2 bytes for 27.

share|improve this answer

Ruby, 16 bytes

p Time.now+864e4

Try it online!

share|improve this answer

JavaScript, 38 Bytes

d=new Date;d.setDate(d.getDate()+100);d

A little bit shorter than ASCII-only answer.

document.write(eval("d=new Date;d.setDate(d.getDate()+100);d"))

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.