Skip to main content

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
103 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 ...
algorithmshark's user avatar
101 votes
59 answers
18k views

Sleep for 1000 years

Some sleep commands implement a delay of an integer number of seconds. However, 2³² seconds is only about 100 years. Bug! What if you need a larger delay? Make a ...
anatolyg's user avatar
  • 13.7k
81 votes
40 answers
12k views

Wait a minute – in less than ten seconds

Task Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half). The program/function must terminate within 10 seconds ...
Adám's user avatar
  • 30.4k
79 votes
43 answers
7k views

Legen… wait for it…

dary! In events entirely unrelated to what will hopefully happen to me in the next couple of days, I task you to write code that does the following: Print ...
Dennis's user avatar
  • 210k
72 votes
21 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....
DJMcMayhem's user avatar
  • 59.3k
68 votes
70 answers
9k views

Convert YYYYMM to MMMYY

Basing on this SO question. Challenge is rather simple: given a date period in the format YYYYMM output it in the format MMMYY. ...
pajonk's user avatar
  • 16.7k
67 votes
52 answers
8k views

Increment The Time

Every digital clock contains a small creature that has to advance the time every minute [citation needed]. Due to the popularty of digital clocks and the popularity of catching them in the wild, they ...
flawr's user avatar
  • 43.8k
66 votes
14 answers
5k views

Print a word clock

Since I saw the first one a few years ago, I always was subjugated by this kind of word clock where the time is actually spelled out by words being lit up or not into a meaningful sentence. The text ...
Olivier Grégoire's user avatar
59 votes
13 answers
8k views

Who was president of the USA?

Challenge Write a program that takes as input a day from April 30, 1789 to August 21, 2019 and returns as output who was president of the USA that day. Notes For the list of US presidents, the ...
Kate's user avatar
  • 669
56 votes
35 answers
7k views

Encode the date in Christmas Eve format

The day this post was published was Christmas Eve. Tomorrow will be Christmas. Yesterday was Christmas Eve Eve. In two days it will be ...
Christopher King's user avatar
53 votes
53 answers
5k views

I'm too cold, turn up the temperature

This is my first golf contest. What you need to do Build me, in the shortest amount of bytes possible, my AC remote control system. My room is too cold right now, and I'm missing my remote. Now, I ...
user avatar
53 votes
6 answers
5k 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 ...
Calvin's Hobbies's user avatar
51 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 ...
ugoren's user avatar
  • 17.5k
49 votes
52 answers
9k views

We had a question once which only failed on Sundays

Inspired by We had a unit test once which only failed on Sundays, write a program or function that does nothing but throw an error when it is Sunday, and exit gracefully on any other day. Rules: No ...
Jo King's user avatar
  • 47.2k
49 votes
23 answers
10k views

Type the Alphabet - as fast as you can!

Your task is to make a program that measures how fast you can type the letters of the English alphabet. The program shall only accept lowercase letters a to ...
Danko Durbić's user avatar
47 votes
79 answers
10k 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
47 votes
69 answers
8k views

List of possible birth years of living humans

The Challenge Output a list of years that starts with the current year and ends 120 years ago. The birth year of every living human would be included in this list. Details The list should be in ...
Christiaan Westerbeek's user avatar
46 votes
28 answers
4k views

Big Ben goes BONG

Your task is to create a program that is to mimic Big Ben (Twitter). Task Whenever a new hour has begun (according to your computer's local time or UTC), you have to output ...
user41805's user avatar
  • 13.1k
46 votes
9 answers
3k views

Read a date in xkcd notation

In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation: The large numbers are all the digits that appear in the current date in their usual order, ...
Martin Ender's user avatar
45 votes
94 answers
5k views

Output the Current Time

Challenge You must output the current time continuously (until cancelled by an interrupt), once every second, by any of the following means: It must be in 24-hour or AM/PM format. If it is the ...
Addison Crump's 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 ...
NinjaBearMonkey's user avatar
40 votes
29 answers
11k views

Happy Birthday, Finland!

Introduction As is known, in 2017, Finland celebrates its 100 years of independence. To mark the occasion, it is your job to produce a Finnish flag for everyone's enjoyment. Challenge Create a ...
Antti29's user avatar
  • 969
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 ...
jqkul's user avatar
  • 2,272
38 votes
34 answers
5k views

Advance Happy New Year, 2016!

Your input will be a integer between 1970 and 2090 (inclusive), representing a year. Your program should output the next year on which New Years Day falls on the same day of the week as the input year....
Vasu Adari's user avatar
38 votes
6 answers
2k views

COBOL Y2K redux

In the 1990s, COBOL computer engineers worked out a way to extend six-digit date fields by converting them to YYYDDD where YYY ...
user avatar
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 ...
Beta Decay's user avatar
  • 23.4k
36 votes
14 answers
2k views

Today is the Center

Given a date as input in any convenient format, output a calendar with that date as the exact center of a five-week window. The header of the calendar must include the two-letter abbreviations for the ...
AdmBorkBork's user avatar
  • 43.4k
35 votes
67 answers
4k views

It's [current year] already, folks, go home

On most new-years challenges when it is currently not the corresponding year of the challenge, It says this in the front. It's [current year] already, folks, go home. You have to output this text ...
Matthew Roh's user avatar
  • 5,347
35 votes
38 answers
4k views

Is it Christmas?

Challenge Given that Christmas is: December Month 12 Day 25 Every year, determine today's date, and whether or not today is Christmas. If it is Christmas, you must print ...
Patrick Perini's user avatar
35 votes
28 answers
2k views

Merry Golfmas, Everyone!

It's Christmas everybody, and here's a code-golf challenge to celebrate. You need to make a program to print out a present. Specifically, the words "Merry Christmas". BUT, there is a catch: this ...
Leo's user avatar
  • 1,364
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 ...
Sean Latham's user avatar
  • 1,413
33 votes
43 answers
7k views

Is it really time?

A time in the format hhMMss is represented by six numbers in the range 0..9 (e.g.100203 for 3 seconds after 2 minutes after 10am (10:02.03), or ...
simonalexander2005's user avatar
33 votes
12 answers
3k views

How many countries are in the European Union?

Tonight, 31 January 2020, Brexit will happen and the United Kingdom will leave the European Union, the first time that the number of EU member states will decrease. Your job is to take a date and ...
Robin Ryder's user avatar
  • 15.6k
32 votes
9 answers
3k views

The symmetry of months

Introduction Some months are completely symmetric, meaning they have central symmetry as well as reflection symmetry, like February of 2010: ...
mkierc's user avatar
  • 423
31 votes
35 answers
5k views

Help, I've mixed my week up!

My dog ate my calendar, and now my days are all mixed up. I tried putting it back together, but I keep mixing up the days of the week! I need some help putting my calendar back together, with the days ...
maxb's user avatar
  • 6,897
31 votes
37 answers
8k views

How many friday the 13th in a year?

Your challenge is to write a program which, given a year, outputs the number of "Friday 13ths" in it. Rules & Details: You can take input via STDIN, or as an ...
Cruncher's user avatar
  • 2,283
31 votes
22 answers
4k views

The Time Anagram

Originally posted (and deleted) by @Tlink, which was most likely inspired from this StackOverflow question. Since it was a shame it got deleted, because it seemed like a good challenge in general, I ...
Kevin Cruijssen's user avatar
31 votes
8 answers
3k views

crossed out 44 is still regular 44 ;(

Introduction On March 24th, 2015 @isaacg golfed his Pyth answer from 44 to 42 bytes. Since a crossed out 44 (44) looks a lot like a regular 44, @Optimizer made the following comment: striked out ...
Kevin Cruijssen's user avatar
30 votes
26 answers
6k views

How much time is remaining?

The Program You are given two strings, A and B. A is the current position at which your timer is at, and B is the position at which your timer will stop. Both strings are in the format m:ss. You must ...
Josh's user avatar
  • 1,131
30 votes
39 answers
4k views

The Last Monday

Monday, October 31st, is Halloween. And it got me thinking -- I wonder what other months have the last day of the month also be a Monday? Input A positive integer in any convenient format ...
AdmBorkBork's user avatar
  • 43.4k
30 votes
24 answers
3k views

Setting the time

Imagine the following 24-hour clock that can be controlled by arrow keys: ╔══╗ ┌──┐ ║00║:│00│ ╚══╝ └──┘ HH mm Pressing the up arrow twice (...
Etheryte's user avatar
  • 3,838
30 votes
26 answers
8k views

When will Brexit happen?

Well, Brexit happened. And Sky News, being the geniuses they are, have decided to create a countdown on the side of a bus. Your job is to do something similar. The UK leaves the the EU on 31st of ...
caird coinheringaahin g's user avatar
30 votes
19 answers
4k views

How old is it roughly?

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English. Your program must output the least precise amount of time which ...
bitconfused's user avatar
30 votes
7 answers
2k views

Compute the RFC 2550 timestamp

RFC 2550 is a satirical proposal (published on April 1, 1999) for a space-efficient ASCII representation of timestamps that can support any date (even those prior to the beginning of the universe and ...
user avatar
29 votes
36 answers
3k views

Days in indexed month

This simple challenge is very similar to this one: How many days in a month? The only difference is you yield the number of days in a month given the index of the month instead of its name. The ...
Luke Sawczak's user avatar
29 votes
68 answers
4k views

What's the Date?

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 ...
Beta Decay's user avatar
  • 23.4k
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 ...
mbomb007's user avatar
  • 23.4k
28 votes
40 answers
6k views

12 hour to 24 hour time converter

Amazingly, this simple task doesn't seem to exist already, so... Your task is to write a program that takes as input a 12 hour time, and converts it into "military time", or 24-hour time format. ...
Carcigenicate's user avatar
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. ...
Sam's user avatar
  • 381
28 votes
10 answers
2k views

Alarm Optimization

My Alarm Clock I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button ...
Stephen's user avatar
  • 13.9k

1
2 3 4 5 6