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
16 votes
10 answers
1k views

Digit Date Range

NOTE: Since I'm Dutch myself, all dates are in the Dutch dd-MM-yyyy format in the challenge description and test cases. Challenge: Inputs: Start date \$s\$; End ...
Kevin Cruijssen's user avatar
16 votes
5 answers
2k views

What's the current zodiac?

Display the emoji of the eastern zodiac of given time, according to given country. The eastern zodiac is a classification scheme that assigns an animal and its reputed attributes to each year in a ...
Dannyu NDos's user avatar
  • 5,497
2 votes
0 answers
171 views

Rotated analog clock [closed]

Given: a 12 hour time t in hours and minutes, a rotation r in degrees, return the time shown when an analog clock that is ...
anna328p's user avatar
  • 6,334
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
6 votes
20 answers
628 views

Get delta of days by current hour and added delta of days

Inputs: current hour: from 0 to 23 (inclusive) delta of hours: [current hour] + ...
Ivan Gerasimenko's user avatar
24 votes
5 answers
617 views

How long's left?

How long's left? Recently, I was making pizza using a 5-minute timer on my phone. When someone walked in and asked me how long was left, I was confused for a moment at first as to how to answer the ...
Geza Kerecsenyi's user avatar
10 votes
17 answers
1k views

Tesco's Burger Relish Best Before End date number

Given a date between 2010-01-01 and 2099-12-31 as three integers (please state your order if not [year,month,day]), answer with Tesco's corresponding five-digit ...
Adám's user avatar
  • 29.9k
26 votes
19 answers
3k views

Analog is Obtuse!

An analog clock has 2 hands*: Hour and minute. These hands circle the clock's face as time goes by. Each full rotation of the minute hand results in 1/12th of a rotation of the hour hand. 2 full ...
Mayube's user avatar
  • 11.6k
-1 votes
14 answers
608 views

FizzBuzz but time-based

Make a program that outputs the number of seconds from the beginning of today (00:00:00 of the day you run it) to the second you ran it. However, if this number is divisible by three, print ...
AndrewTheCodegolfer's user avatar
-6 votes
10 answers
262 views

The year counter is here [closed]

Create a program that, given an integer N, outputs the number of years we have to get to N A.D. or how many years it has been since N A.D, as a string or int. For example, given 2014, the program ...
AndrewTheCodegolfer's user avatar
8 votes
7 answers
818 views

Output the date in the Mel calendar

The Mel calendar is used in the fictional world of Kaldia. Your goal is to convert dates into the Mel calendar. This calendar has 13 months of 28 days each, plus 1 or 2 extra days after the last ...
bb94's user avatar
  • 2,561
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.3k
0 votes
1 answer
365 views

Which were the latest 13 consecutive years with the most friday 13. in total? [closed]

Shortest program wins, of course.
Konstantin's user avatar
22 votes
20 answers
5k views

It's a yearly task, alright

Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of". The Gregorian calendar will be used and the ...
AndrewTheCodegolfer's user avatar
16 votes
9 answers
4k views

Finding Gaps in Date Ranges

Given a list of date ranges r as input, output or return any ranges not found in r. For the sake of this example, input will be ...
Oliver's user avatar
  • 7,842
10 votes
21 answers
2k views

Unix timestamp to datetime string

Given a unix timestamp as an input, give a datetime string, in a format like so: "YYMMDD.HHmm" Rules The input is a number (integer) of a millisecond-precise UNIX epoch time (milliseconds since 1970 ...
skiilaa's user avatar
  • 223
8 votes
11 answers
616 views

Mis-decode a date

Background Inspired by a now deleted question by John Burger from which I quote: Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: ...
Adám's user avatar
  • 29.9k
20 votes
17 answers
5k views

Get the date of the nth day of week in a given year and month

Introduction Often, people refer to dates as the "second Friday in August, 2018" or the "fourth Sunday in March, 2012". But it's hard to tell what date that is! Your task to is to ...
Gymhgy's user avatar
  • 7,988
55 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 ...
PyRulez's user avatar
  • 7,207
16 votes
10 answers
2k views

Convert an Excel date code to a "date"

Given a non-negative integer Excel-style date code, return the corresponding "date" in any reasonable form that clearly shows year, month, and "day". Trivial, you may think. Did you notice the "scare ...
Adám's user avatar
  • 29.9k
12 votes
9 answers
1k views

Through Space and Time

Introduction: In general we usually speak of four dimensions: three space dimensions for x, y, and ...
Kevin Cruijssen's user avatar
11 votes
5 answers
3k views

ASCII Calendar Planner

Given a list of activities and their start time/date, output an ASCII-art calendar showing the activities on the appropriate days. All activities are guaranteed to be in the same month, no two ...
AdmBorkBork's user avatar
  • 43.3k
20 votes
26 answers
5k views

The Work Day Countdown

I just had a genius idea for making the work-life easier - a countdown to a specific date which only counts workdays. The basic task is to create a countdown to a specific date which only includes ...
Hille's user avatar
  • 389
4 votes
4 answers
417 views

Hey, what time is it?

Challenge Given a number width, number height, hours and ...
DimChtz's user avatar
  • 957
14 votes
11 answers
4k views

A greeting bot for a colleague from work

I have a colleague at work that works from home every Tuesday and Thursday. At around 8:00 AM he sends us a message with the following text: Hello today I'm working from home In order to relieve ...
Charlie's user avatar
  • 12.8k
8 votes
18 answers
3k views

Greet according to the time of day

Challenge Write a program that greets a user depending on what time of day (GMT) it is. Output A string (printed or returned) according to these rules: If the time is 06:00 to 11:59 the greeting has ...
lolad's user avatar
  • 842
30 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
9 votes
11 answers
685 views

The Clock Hands of Doom

You are chained to a chair. Underneath you is a huge volcano. A 12-hour clock next to you ticks ominously, and you see that it has wires leading from the back up to a chain, which will drop you into ...
Rydwolf Programs's user avatar
14 votes
11 answers
951 views

Computing time sheets

Time sheets In a work place you often have to complete time sheets. This task is write code to help this. Input Two times in a slightly non- standard 12 hour clock signifying the start and end of the ...
user avatar
5 votes
4 answers
492 views

Einstein's Sorter

Challenge Given a list of integers and a velocity, \$v\$, implement a sorting algorithm which simulates a program sorting the list from smallest to biggest at the given velocity. Einstein's Theory ...
Beta Decay's user avatar
  • 23.3k
10 votes
10 answers
439 views

Date Occurrences

Given three non-negative integers y, m, and d (of which at least one must be positive) and a ...
user avatar
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,798
37 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
24 votes
14 answers
2k views

Prime Time Travel

Don't tell anyone, but I've nicked my uncle's time travel machine! My uncle is obsessed with prime numbers, though, and that shows in the machine — he has programmed it so that it can only go to dates ...
Sundar R's user avatar
  • 6,612
17 votes
16 answers
1k views

Count the timespans

Inspired by a real-life scenario, which I have asked for an answer to here: https://superuser.com/questions/1312212/writing-a-formula-to-count-how-many-times-each-date-appears-in-a-set-of-date-ran ...
simonalexander2005's user avatar
30 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
19 votes
31 answers
2k views

Date Multiplying Challenge

(Inspired by last week's Riddler on FiveThirtyEight.com. Sandbox post.) Given a year between 2001 and 2099, calculate and return the number of days during that calendar year where ...
BradC's user avatar
  • 6,767
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
9 votes
5 answers
407 views

Ticking Quine-Bomb!

Challenge: Create a program or function that takes an integer input, which outputs a new program/function as specified below. Input: Integer n: Time in seconds ...
Kevin Cruijssen's user avatar
29 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
11 votes
13 answers
2k views

List all palindromic prime dates between 0000-01-01 and 99999-12-31

You know what a palindrome, a prime and a date are. Your task is to list all dates in 100 thousands of years that fulfill all three characteristics. Nevermind anything but the numbers, use the ...
Peter Wirdemo's user avatar
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.1k
14 votes
6 answers
813 views

Match the Striking Clock

Introduction: At home we have a clock that strikes the stated amount at each hour, but also strikes once at every half-hour. So from 0:01 to and including 12:00 it strikes in this order: ...
Kevin Cruijssen's user avatar
15 votes
9 answers
760 views

Finding My Favorite Times

I really like times that follow certain patterns. In particular, I like times where all the digits are the same, or all of the digits increase arithmetically by one from left to right. Further, I ...
hBy2Py's user avatar
  • 255
14 votes
7 answers
785 views

Could They Be The Same Day Of The Week?

Challenge Given a non-negative integer, output whether it is possible for two dates (of the Gregorian calendar) differing by exactly that many years to share a day of the week. A year is assumed to be ...
Jonathan Allan's user avatar
25 votes
37 answers
4k views

Implement a Simple Stopwatch

Challenge Your task is to write a program which, once a second (including immediately when your program is started), prints the elapsed time from the time your program was started. Rules Time must ...
MarkWeston's user avatar
9 votes
1 answer
492 views

The working time calculator

This is based on how my company deals with the monitoring of the working times for every employee. Each one of us has a card that can be passed in front of a sensor, so that a clock registers the ...
Charlie's user avatar
  • 12.8k
10 votes
7 answers
339 views

Days and months make years

Today's date is quite an interesting one. Let's take a look at why. The date 07/12/2017 (in DD/MM/YYYY date format) can be split ...
caird coinheringaahin g's user avatar
40 votes
28 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
8 votes
7 answers
432 views

The Microwave Challenge

Inspired by this comment. Input The number of seconds on the timer. Output Here's our basic microwave: ...
Nissa's user avatar
  • 3,616