# 100 Day Countdown

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.

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 ], 10/8/16 12:00:00 AM).

## 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

• Can I add the current time to the output? Commented Apr 6, 2017 at 4:05
• @Titus no, just the future date Commented Apr 6, 2017 at 10:30
• Most answers include a date and time now, I think this should be allowed.
– G B
Commented Apr 6, 2017 at 12:25
• "Because of our bas 10 system"? No, if we counted in binary, we'd likely count down from 100 - except that would take only four days, rather than a hundred... Commented Apr 6, 2017 at 12:54
• @12431234123412341234123 this format is perfectly readable for me (in fact, it's pretty much a de-facto standard where I live). It all depends on where you're from. Commented Apr 8, 2017 at 20:30

# Excel, 10

=NOW()+100


### Demonstration

• Also works in Google Sheets.
– Okx
Commented Apr 6, 2017 at 11:00
• Excel is always good for code golf that involves parsing dates. Commented Apr 6, 2017 at 12:21
• Is there a language pack for excel in which the NOW function is spelled out with just two letters? In that case, you could save 1 byte. Commented Apr 7, 2017 at 9:20
• Yep, Dutch has 'nu()' Commented Apr 7, 2017 at 9:31
• Although, per date part only, you'd have to use =TODAY()+100 or =TEXT(NOW()+100,"MM/dd/yyyy")
– KyleMit
Commented Apr 7, 2017 at 19:36

# Bash, 17161514 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!)

• New favorite command +1 Commented Apr 6, 2017 at 2:32
• @NonlinearFruit Hah, yeah, it's probably one of my favorite commands. Thanks! Commented Apr 6, 2017 at 2:37
• You don't need the space after -d Commented Apr 6, 2017 at 2:47
• @ASCII-only Oh, okay. Thanks! Commented Apr 6, 2017 at 2:47

# PowerShell, 10 bytes

(date)+1e2


Thanks to ConnorLSW for the +1e2 trick.

It appears that doubles (1e2 is a double) are also added as days.

### Previous version, 12 bytes:

(date)+"100"


Apparently you can add strings to dates in PowerShell. The string "100" is converted into a 100 days-TimeSpan.

• Ok don't ask me why, but even though (date)+100 doesn't work, (date)+1e2 does... I guess 1e2 is actually a double whereas 100 is a number until it's compiled, i.e. you can't call 100.GetType() but you can 1e2.GetType() - that's -2 and brings us to a draw with Excel! Commented Apr 6, 2017 at 16:18
• @ConnorLSW If it help or adds to the confusion 100 is seen as adding 100 ticks where as the string "100" is taken as days. Both are valid PS but only one does what we need.
– Matt
Commented Apr 6, 2017 at 18:32
• @Matt 1e6 is still a number and is added as days though? Commented Apr 6, 2017 at 18:33
• That is interesting then. Perhaps there is more going on under the hood where that number reaches over a threshold.... I do not know
– Matt
Commented Apr 6, 2017 at 18:35
• I think it's somehow related to the old DATE type which is an 8-byte floating point number with days being represented as whole number increments. I guess that's what Excel is using. Commented Apr 6, 2017 at 19:15

# Mediawiki, 19bytes

{{#time:r|+100day}}


You may try it with wikipedia's sandbox

• Welcome to PPCG! Commented Apr 8, 2017 at 11:05

# PHP, 28 bytes

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


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


<?=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.

• The underscores made me do "Why underscores, is it a constant? No, a string OH WAIT 'SPACES'!!" Clever. Commented Apr 7, 2017 at 7:58
• @Martijn Turn on E_NOTICE and You´ll know: Y_m_d is an undefined constant and PHP assumes a string. This works with any valid word (including all function names) apart from keywords, predefined constants and case insensitive true, false and null. Commented Apr 7, 2017 at 10:42

# Ruby, 16 bytes

p Time.now+864e4


Try it online!

• Was going to answer this, nice. But I get different results for 864e4 and 8640000 and I don't quite know why. I blame TIO. EDIT: when you use p, the two values produce a different result. But when you use puts, they're the same. Commented Apr 10, 2017 at 13:09
• I don't understand, I get the same result with both. Can you post an example? Maybe it depends on the locale?
– G B
Commented Apr 10, 2017 at 13:41
• p Time.now+864e4 is around 4 days behind p Time.now+8640000 on TIO. I tried it multiple times. However, if you use puts, this distinction doesn't exist. I don't really know if my locale matters, US East should be pretty normal :P I guess I'll try running it on my own PC when I get home. Commented Apr 10, 2017 at 15:15

# Javascript, 2926 25 bytes

Saved 3 bytes thanks to @ASCII-only!

Saved 1 byte thanks to @JohanKarlsson

new Date(+new Date+864e7)


document.body.innerHTML=new Date(+new Date+864e7)

• You can use 864e7 instead of 864*10e6 Commented Apr 6, 2017 at 10:18
• You can save 1 byte by using +new Date instead of Date.now() Commented Apr 6, 2017 at 12:00
• This is a snippet. You need to include console.log Commented Apr 7, 2017 at 16:10

## SQL (PostgreSQL), 19 Bytes

SELECT now()+'100d'


# Vim, 27 bytes

:r!date "+\%F" -d"+100 day"


try it online!

Edit: Removed unnecessary space char.

• If you're using Linux date, the one on this page is date -d100day, not sure if it will help though Commented Apr 6, 2017 at 10:26
• I test it with :r!date +\%F -d100day this also works (at least on my pc (C)), but is the same as HyperNeutrino already use in bash. Commented Apr 7, 2017 at 11:03
• Uh, you can save bytes by just eliminating vim and doing it in bash. Commented Apr 8, 2017 at 8:05

# MATL, 9 bytes

Z'100+1XO


Output format is 15-Jul-2017 (which I find most readable). Change 1XO to 2XO to get the format used in the examples, 07/15/17.

Try it online!

### Explanation

Z'      % Push current date and time as a serial date number
1XO     % Convert to string with format 'dd-mmm-yyyy'. Implicitly display


SQL (Microsoft), 35 31 bytes

SELECT DATEADD(D,100,GETDATE())

• You can use d instead of DAY and remove the spaces inside DATEADD. Commented Apr 6, 2017 at 16:27
• Even I didn't know you could use d. I use dd or day in practice. I just tried it and it worked. Commented Apr 7, 2017 at 3:12

# Java 8, 77, 61 bytes

()->System.out.print(java.time.LocalDate.now().plusDays(100))


Try it online!

• Is there a reason you don't include the boilerplate? (ie 'class A{public static. . .') For Java, I believe at is necessary for a full program. You could do a lambda ()->java.time.LocalDate.now().plusDays(100). Commented Apr 6, 2017 at 10:34
• I had that before editing my answer. It was 94 bytes along with the boilerplate. I new to golfing with java. hence I aint sure about whether I had to include that! Commented Apr 6, 2017 at 10:46
• Submissions (unless otherwise specified) can be either a full program (runnable by some interpreter without modification) or a function. Commented Apr 6, 2017 at 12:22

# C#, 103 97 bytes

Thanks to raznagul for saving 6 bytes!

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


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:

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 43 bytes

()=>DateTime.Now.AddDays(100).ToString("d")


Full program:

using System;

class P
{
static void Main()
{
Func<string> f =

Console.WriteLine(f());
}
}

• For the full program I think you can write System.DateTime.Now... to avoid "using System;" Commented Apr 6, 2017 at 7:33
• @Taemyr: That would be longer, as he also needs it for Console.Write. Commented Apr 6, 2017 at 8:17
• @adrianmp: You can save save 6 bytes by using .ToString("d") instead of .ToShortDateString(). Commented Apr 6, 2017 at 8:24

# Noodel, 8 bytes

]5@LaƇ⁺ƈ


Try it:)

## How it works

]5@LaƇ⁺ƈ
]5@La    # The string "]5@La" gets pushed onto the stack which in base 98 represents 8,640,000,000.
Ƈ   # Pushes an integer that represents the current time where highest resolution is milliseconds.
⁺  # Add the time and the string which will be interpreted as 8,640,000,000ms.
ƈ # Convert the integer to human readable time.
# Implicitly output to the screen.


<div id="noodel" code="]5@LaƇ⁺ƈ" input="" cols="80" rows="2"/>

<script src="https://tkellehe.github.io/noodel/noodel-latest.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>

• The character Ƈ is the unicode character U+0187, which is too large to be displayed in a single byte. Same goes for ƈ (U+0188). So while this is 8 characters long, the minimum byte-length is 10. Commented Apr 7, 2017 at 9:33
• @iFreilicht, Noodel uses its own encoding. The editor does everything in UTF-16 to work better visually, but gets encoded based off of the Noodel code page before parsing. Commented Apr 7, 2017 at 10:24

# Mathematica, 26 21 bytes

-5 bytes thanks to @KiranLinsuain!

Today+Quantity@"100d"


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

Now+Quantity@"100d"

• "Now + Quantity["100d"]" cuts it down quite a bit, but may not always work on all versions.
– k-l
Commented Apr 7, 2017 at 5:41

# C, 8746 44 bytes

saved 2 bytes thanks to Albert Renshaw

f(){time_t t=time(0)+864e4;puts(ctime(&t));}


I realized the output is flexible enough to allow for day of week and time, so there's no need to use localtime or the tm structure at all.

f(){time_t t=time(0)+8640000;char b[9];strftime(b,9,"%d-%m-%y",localtime(&t));puts(b);}


Based on Khaled.K's answer, but instead of messing with the tm structure, adds the number of seconds equivalent to 100 days directly to the time_t value. It also prints only the date, without time or day of week.

As it should happen on a golfed program, some ugly warnings are generated on compilation.

Try it online!

### Ungolfed:

f(){
// Current time + 100 days
time_t t=time(0)+8640000;
// Buffer for printing formatted time
char b[9];
// Print the time in format dd-mm-yy to buffer
strftime(b,9,"%d-%m-%y",localtime(&t));
// print buffer
puts(b);
}

• Shave 2 bytes by replacing 8640000 with 864e4 Commented Apr 7, 2017 at 7:43

# JavaScript, 42 bytes

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


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

# 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.

## JavaScript (ES6), 44 bytes

_=>new Date(Date.now()+864e7).toDateString()


25 bytes if returning a date with the time is acceptable:

_=>Date(Date.now()+864e7)


# 30 bytes

Mysql!

select NOW()+INTERVAL 100 DAY;


SQLite

SELECT date('now','+100 day');


# F# (53 bytes)

printf"%s"(DateTime.Now.AddDays(100.0).ToString("d"))

• Don't see a lot of F# answers on here. Kudos! Commented Apr 8, 2017 at 8:16

## Swift 3, 39 bytes

print(Date(timeIntervalSinceNow:864E4))

• I'd argue you don't need the import foundation;. Swift runs just on iOS and that is auto imported there. Commented Apr 7, 2017 at 7:37
• There aren't too many Swift answers here yet, so not sure what the consensus is. But I think you have a good point, I'll remove the import :)
– Matt
Commented Apr 7, 2017 at 10:11
• @Albert Swift also runs on Mac OS and Linux. I don't know what that means for whether the import is required, though. Commented Apr 8, 2017 at 8:10

# C, 120 113 bytes

#include <time.h>
f(){time_t t=time(0);struct tm*tm=localtime(&t);tm->tm_mday+=100;t=mktime(tm);printf("%s",ctime(&t));}


Live Demo

#include <stdio.h>
#include <time.h>

void PrintDatePlus100days()
{
// obtain current time
time_t t = time( 0 );

// convert to datetime struct
struct tm *tm = localtime( &t );

tm->tm_mday += 100;

// convert to time_t
t = mktime( tm );

// print time in readable format
puts( ctime( &t ) );
}

• If I'm not mistaken, you don't need to account for #include ... boilerplate when submitting functions. (Java answers, for example, don't need import in that case) Commented Apr 6, 2017 at 23:43
• @CássioRenan in Java you don't need to count the default imports like java.lang.*, just like how we don't count stdio.h and stdlib.h in C. But even in java, you need to either consider custom imports or put the path in the class name like java.util.Date, and that counts in your score. Commented Apr 7, 2017 at 9:03
• Why using printf() would puts() not also work? Commented Apr 7, 2017 at 11:04

PowerShell, 23

(get-date).adddays(100)


This is my first ever try, so please give me constructive feedback. Thanks!

# R (REPL), 14 bytes

Sys.Date()+100


Try it on Ideone.

• This is a snippet. Your code is required to output the result, either as the result of a function, or to STDOUT as a full program. Commented Apr 6, 2017 at 20:25
• Commented Apr 7, 2017 at 16:04
• @mbomb007 REPL answers are allowed, but they're considered a separate language. Commented Apr 11, 2017 at 22:35
• @Dennis It wasn't listed as REPL before. Commented Apr 12, 2017 at 3:48

# 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.

• It doesn't have to be a function. You could remove the lambda: and it would still be a full program. Commented Apr 6, 2017 at 3:15
• @NonlinearFruit Yes but print would have to be added and that makes it the same number of bytes.
– user67196
Commented Apr 6, 2017 at 3:20
• If you use Python 2, you can remove brackets in print to save 1 byte Commented Apr 6, 2017 at 9:26
• the days= is optional, that would save 5+1 bytes (python2 print's brackets) Commented Apr 6, 2017 at 11:10
• Golfed down to 57 bytes: from datetime import*;print datetime.now()+timedelta(100) Commented Apr 6, 2017 at 13:16

# 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"))

# Golang, 58 bytes

import ."time"


Full Program

package main

import . "time"
import . "fmt"

func main() {
}


try it online!

Oracle, 34 bytes

SELECT CURRENT_DATE+100 FROM DUAL;


# Python 2 + Pandas 0.19.1, 56 51 bytes

from pandas import*
print Timestamp('now','D')+100