What Day Will It Be in 100 Days?
What Day Will It Be in 100 Days?
Do you want to know what date and day it will be after 10, 50, or even 100 days?
With Function Calculator, you can calculate it yourself — no Google needed. 🚀
1. Today’s Date: now()
The built-in function now() gives today’s date and time as a 14-digit number.
Example:
20250921130330
This means:
Year = 2025
Month = 09
Day = 21
Hour =13
Minute = 03
Second = 30
2. Days in Each Month (with Switch)
Since our script has no lists, we use switch statements to handle month lengths.
(Copy below code and go to the Factory page in the calculator and paste it. Press run button to implement code and press save button to save your function.)
def getDaysInMonth(year, month) {
if (month==1) {
return 31;
} else if (month==2) {
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
return 29;
} else {
return 28;
}
} else if (month==3) {
return 31;
} else if (month==4) {
return 30;
} else if (month==5) {
return 31;
} else if (month==6) {
return 30;
} else if (month==7) {
return 31;
} else if (month==8) {
return 31;
} else if (month==9) {
return 30;
} else if (month==10) {
return 31;
} else if (month==11) {
return 30;
} else {
return 31;
}
}
3. Move Forward by N Days
Now we can write the daysLater(n) function:
def daysLater(n) {
var t = now();
var year = floor(t / 10000000000);
var month = floor((t / 100000000) % 100);
var day = floor((t / 1000000) % 100);
day = day + n;
while (true) {
var dim = getDaysInMonth(year, month);
if (day <= dim) {
break;
}
day = day - dim;
month = month + 1;
if (month > 12) {
month = 1;
year = year + 1;
}
}
return year * 10000 + month * 100 + day;
}
This returns a number in YYYYMMDD format.
4. Day of the Week
We use your existing dayOfWeek(year,month,day) function.
It returns:
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
5. Combine Date + Weekday
Finally, we build the main function:
def dateAndDayLater(n) {
var d = daysLater(n);
var y = floor(d / 10000);
var m = floor((d / 100) % 100);
var da = d % 100;
var w = dayOfWeek(y, m, da);
return y * 100000 + m * 1000 + da * 10 + w;
}
It returns one number in this format:
YYYYMMDDW
6. Examples 🎉
dateAndDayLater(10) → 202510013
→ 2025-10-01, Wednesday (3)
dateAndDayLater(100) → 202512302
→ 2025-12-30, Tuesday (2)
dateAndDayLater(-50) → 202508026
→ 2025-08-02, Saturday (6)
✨ Why It’s Useful
Quickly check deadlines → “What day is it in 90 days?”
Plan vacations, exams, or countdowns
Travel back in time → “What day was it 200 days ago?”
Your calculator becomes a calendar and day-of-week predictor with just a few lines of code. 🙌
Comments
Post a Comment