Questions tagged [date]

This challenge is intended to be solved by using, manipulating, accepting as input, outputting, or calculating calendar dates or clock times.

Filter by
Sorted by
Tagged with
38 votes
28 answers
30k views

When is Thanksgiving?

Background Some holidays have fixed, easy-to-remember dates, like Oct 31, Dec 25, etc. Some, however, want to be troublesome. They're specified as things like "the first Monday in September" or "the ...
user avatar
  • 2,202
12 votes
3 answers
585 views

Festival of ASCII-art lights

Write, in as few characters as possible, a program that takes zero or six command-line arguments menorah menorah YEAR MONTH DAY HOUR MINUTE SECOND (Both forms ...
user avatar
  • 6,521
15 votes
3 answers
737 views

Help me manage my time

I have been recently told to read an entire physics textbook by the new year (true story, unfortunately). I need your help to determine what chapters I should read each day. This is where you come in. ...
user avatar
  • 7,384
26 votes
3 answers
586 views

Combined 100 year birthday

I was recently adding up the ages of myself and my wife and kids and realised that at some point in the not-too-distant future our ages will all add up to exactly 100 years. Challenge For an input ...
user avatar
19 votes
1 answer
2k views

Make a math equation from the date

In my Economics class, my friends and I like to come up with ways to rearrange the digits in the date (in MM/DD/YY) format to create a valid mathematical equation. For the most part, we are allowed to ...
user avatar
  • 7,219
16 votes
1 answer
487 views

Which Ubuntu versions are supported?

Given an input date, your entry will output the full list of supported versions of the Ubuntu Linux distro on that date. The full list of all releases is as follows: Version Code name ...
user avatar
52 votes
19 answers
6k views

Detect Time Travel

Computers are everywhere nowadays - in cars, trains, skateboards, even nuclear reactors. The possibility that your software will run in a time travelling device is just a matter of time. Can you deal ...
user avatar
  • 17.3k
6 votes
7 answers
759 views

Arbitrary Clock Time Calculator

Create a routine to calculate the position of each unit of a clock with an arbitrary number of units (minutes, hours, half-days, days, years, parsecs, quarter-quells, etc), where each unit can be ...
user avatar
  • 163
20 votes
8 answers
2k views

Find our missing dead

Challenge Peter has risen again to save us from the duplicate challenges! Peter Taylor is dead, and there's no doubt about it (well, apart from the huge amount of doubt we have... but just ignore ...
user avatar
  • 22.8k
21 votes
3 answers
436 views

Perform a Pluto flyby

Congratulations! You've just been hired by NASA to work on the new Horizons 2 project. Sadly, there have been huge budget cuts recently, so the top management has decided to fake the whole planned ...
user avatar
  • 8,383
21 votes
4 answers
952 views

Telling time in French

Bonjour, PPCG ! Quelle heure est-il ? This means what time is it in French, for that is exactly what this challenge is about. Telling time in French (at least formally) is a bit different from ...
user avatar
26 votes
9 answers
666 views

Track listings to time tables

Introduction Don't you hate it when someone uploads an album you like to YouTube, but the description only contains a track listing? Like this: ...
user avatar
  • 66.1k
12 votes
5 answers
752 views

See you in another life, brotha!

Most of us LOST fans out there remember the computer that Desmond had to type the characters "4 8 15 16 23 42" in every 108 minutes or the world would end (or would it?). The challenge here is to ...
user avatar
42 votes
16 answers
7k views

Use xkcd's formula to approximate the world population

In xkcd 1047, Randall Munroe lists "slightly wrong" approximations of assorted quantities and numbers with varying precision and complexity, such as that the number of liters in a gallon is very close ...
user avatar
20 votes
48 answers
3k views

What's the time, chap?

I honestly cannot believe that this is not a question yet on Code Golf, but.... Print the local time (with a.m. or p.m.) as a string to the console, preceded by "It's ". Example: ...
user avatar
  • 6,565
37 votes
29 answers
9k views

Stop, stand there where you are!

Challenge Write a function which takes one parameter: an integer t. Your function has to stop your program for t seconds before ...
user avatar
  • 22.8k
16 votes
2 answers
751 views

ValiDate ISO 8601 by RX

Challenge Find the shortest regex that validates, i.e. matches, every possible date in the Proleptic Gregorian calendar (which also applies to all dates before its first adoption in 1582) and does ...
user avatar
  • 439
34 votes
21 answers
3k views

What day is it (on Flooptonia)?

You are a space tourist on your way to planet Flooptonia! The flight is going to take another 47,315 years, so to pass the time before you're cryogenically frozen you decide to write a program to help ...
user avatar
  • 1,413
6 votes
1 answer
288 views

Transit all day every day

In addition to contributing to Stack Overflow and other SE sites, I like to ride public transit during my free time. I'd be spending a fortune on cash fare and/or bus tickets every month if I didn't ...
user avatar
5 votes
1 answer
687 views

Most efficient table storage for determining recurrence

The goal of this challenge is to implement a storage and retrieval pattern that will most quickly determine if a set of recurrence definitions fall within a date range. Consider the schema: ...
user avatar
1 vote
0 answers
138 views

The Venerable Bede, 21st Century Style [duplicate]

1300 years ago, the English theologian Bede earned the honorific by which he is now known ("The Venerable Bede") by, among other things, convincingly computing the date of Easter for a number of years....
user avatar
15 votes
13 answers
2k views

Decimal Time of Day Conversion

Introduction Time is confusing. Sixty seconds to a minute, sixty minutes to an hour, twenty-four hours to a day (and not to mention that pesky am/pm!). There's no room for such silliness nowadays, so ...
user avatar
  • 3,538
18 votes
9 answers
2k views

Incremental Game Time Format

Incremental Game Time Format Goal Incremental games often have a countdown timer expressing the days, hours, minutes and seconds until a task is complete. Depending on the space available, they can ...
user avatar
  • 8,570
28 votes
19 answers
3k views

Format microseconds as hours:minutes:seconds, etc

The following is inspired by a question that came up on Stack Overflow today. Given a number of microseconds, 0 <= n <= 86400000000 (e.g. ...
user avatar
  • 381
28 votes
19 answers
5k views

Leap for Leap Seconds!

Since today marks the occasion of the 26th leap second ever to occur, your challenge will be to output the date and time of every leap second in GMT or UTC that has occurred so far, as well as the one ...
user avatar
  • 23k
-4 votes
4 answers
267 views

Workweek completion

I work from Monday to Friday. I start my day at 8:12 and have lunch from 12:00 to 12:42. My ...
user avatar
  • 553
24 votes
4 answers
2k views

What's the time?

I like to save time quite literally, by wearing three watches on my wrist... Problem is they each give a different time. One watch is x minutes behind the actual time. One watch is x minutes ahead of ...
user avatar
44 votes
72 answers
9k views

Is it a leap year?

This challenge is quite simple. You will take an input which will be a year from 1801 to 2400, and output if it is a leap year or not. Your input will have no newlines or trailing spaces: ...
user avatar
10 votes
2 answers
494 views

What date is that again?

On my website, users enter their date of birth in the style xx.xx.xx - three two-digit numbers separated by dots. Unfortunately, I forgot to tell the users exactly ...
user avatar
  • 10.8k
16 votes
9 answers
1k views

Convert human readable time interval to date components

Challenge Write the shortest program that converts a human readable time interval to date components of the form: {±YEARS|±MONTHS|±DAYS|±HOURS|±MINUTES|±SECONDS} ...
user avatar
  • 330
0 votes
0 answers
187 views

Rise and Shine! [duplicate]

Challenge The challenge is to create a program which takes a date, a latitude, and a longitude, and prints the time of the sunrise on that date for the given location. The program must work for any ...
user avatar
  • 1,162
69 votes
20 answers
7k views

Automate Saving the World

You are Desmond Hume. For the last 3 years, you and your partner, Kelvin, have been slave to a computer that requires a very specific sequence to be entered into it every 108 minutes to save the world....
user avatar
  • 57.3k
21 votes
20 answers
3k views

Find the last Sunday in every month of a given year

F# solutions known inside 140 chars, and this is a Rosetta Code problem. Required result on stdout or in a string variable for input year 2014: ...
user avatar
  • 1,412
18 votes
9 answers
1k views

Sum the time durations

Challenge Write the shortest code that can sum all the time durations that appear in the stdin. The program must only consider the strings that match with one of the following patterns and ignore the ...
user avatar
22 votes
5 answers
3k views

Return the clock emoji closest to the current time when run

I can have a large if/else condition for each 30 minutes but I'm looking for more math and Unicode based solution. Here are clock emojis: 🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜...
user avatar
  • 775
24 votes
13 answers
4k views

It's Spanish Time!

I have a simple task that should be relatively easy to implement by means of code. Your goal is to write a program that will output the time written in Spanish, given the time in HH:MM format. Many ...
user avatar
  • 429
3 votes
0 answers
2k views

The World in the Future [closed]

In the future, the world will change, there's no doubt about it. For that reason, you have to produce a realistic map of the world n years in the future. The ...
user avatar
  • 22.8k
20 votes
12 answers
3k views

Plug it back in tonight or this weekend

This is my first code golf so please let me know if it's too broad or if I'm missing any information for a good puzzle! Challenge In Ontario and possibly other areas of the world, electricity is ...
user avatar
9 votes
6 answers
815 views

Shortest script that gives the time passed since a Unix timestamp

What you need to do to win this challenge is to write the shortest "timeago" script that outputs the number of decades, years, weeks, days, hours, minutes, and seconds between a given Unix ...
user avatar
54 votes
6 answers
4k views

ASCII Art Calendar

Let's make an ASCII art clock and calendar that tells us the current month, day of the month, day of the week, hour, minute, and whether it's night or day (but not the year or second). At any ...
user avatar
5 votes
3 answers
532 views

When is my piversary?

Since I want to celebrate this definitely not nerdy event, your job is to calculate the piversary (pi-anniversary) of a given date. Input Your code has to have a possibilty to input a date in the ...
user avatar
  • 1,597
24 votes
21 answers
3k views

When was the last time the date was divisible by n?

A date can be represented by an unsigned integer as such: YYYYMMDD. What you need to do, is write the shortest program or function that figures out the most recent date whose number was divisible by a ...
user avatar
  • 3,550
13 votes
8 answers
2k views

What is your star-sign?

Write a program that takes a birth date (month and day-of-month) as input and outputs the corresponding sign, element and quality of the western zodiac. For the purposes of this challenge, these are ...
user avatar
25 votes
5 answers
5k views

Shortest expression for {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}

Given list of integers {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}. For those who interested these numbers are used in weekday calculation. Weekday = ...
user avatar
  • 2,635
101 votes
14 answers
11k views

Has my milk expired?

Aww, man, this expiry date doesn't write the months with letters! I can't tell if it's expiring on March 10th or October 3rd... Wait, no, never mind, the year says 2012. (alley-oops half-used brick of ...
user avatar
14 votes
7 answers
1k views

Minimalist Hex Clock

Your challenge is to create a clock that displays the time as a hex number, and the background color as the hex color code of the time. Requirements: No input. In the center of your output you ...
user avatar
  • 11.2k
7 votes
2 answers
680 views

Thwarting the Fry King

Setting The Fry King is a small criminal mastermind from the western european nation of Belgium, more specifically Flanders. He has acquired every single fastfood restaurant in a large part of ...
user avatar
  • 501
-4 votes
1 answer
207 views

Longest code to reduce words [closed]

Write a code in your favorite language which reduces words To first three characters. ...
user avatar
  • 2,655
6 votes
7 answers
868 views

Print the time in a digital watch [duplicate]

Write a program that prints the current time in a digital watch. Rules: The program must use the local timezone. Time is expressed between 00:00 to 23:59 (with only hours and minutes). The program ...
user avatar
13 votes
10 answers
1k views

Find all times that follow a pattern

Your job is write a program that prints all times (in the format HH:MM, 24 hours) that follow any of the following patterns: Hours equal to minutes, e.g. 22:22,01:01 Hours equal to reverse minutes, e....
user avatar
  • 298