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
15
votes
10answers
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 ...
1
vote
0answers
131 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 ...
56
votes
13answers
7k 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 ...
5
votes
19answers
503 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] + ...
21
votes
5answers
452 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 ...
7
votes
17answers
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 ...
23
votes
19answers
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 ...
-2
votes
14answers
444 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 ...
-7
votes
10answers
227 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 ...
8
votes
7answers
740 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 ...
36
votes
14answers
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 ...
0
votes
1answer
258 views

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

Shortest program wins, of course.
22
votes
20answers
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 ...
15
votes
9answers
1k 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 ...
8
votes
21answers
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 ...
7
votes
11answers
586 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: ...
17
votes
16answers
2k 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 write a program ...
51
votes
29answers
5k 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 ...
15
votes
10answers
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 ...
10
votes
9answers
1k views

Through Space and Time

Introduction: In general we usually speak of four dimensions: three space dimensions for x, y, and ...
11
votes
5answers
792 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 ...
17
votes
25answers
5k views

The Work Day Countdown

I just had I 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 ...
4
votes
4answers
382 views

Hey, what time is it?

Challenge Given a number width, number height, hours and ...
14
votes
12answers
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 ...
8
votes
18answers
1k 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 ...
18
votes
8answers
2k 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 ...
9
votes
11answers
595 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 ...
14
votes
11answers
902 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 ...
5
votes
4answers
383 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 ...
9
votes
10answers
384 views

Date Occurrences

Given three non-negative integers y, m, and d (of which at least one must be positive) and a ...
27
votes
24answers
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 (...
36
votes
6answers
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 ...
23
votes
13answers
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 ...
17
votes
16answers
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 ...
29
votes
22answers
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 ...
19
votes
31answers
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 ...
32
votes
9answers
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: ...
9
votes
5answers
335 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 ...
29
votes
19answers
3k 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 ...
11
votes
12answers
1k 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 ...
39
votes
44answers
8k 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 ...
14
votes
6answers
757 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: ...
15
votes
9answers
727 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 ...
14
votes
7answers
744 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 ...
25
votes
35answers
3k 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 ...
9
votes
1answer
443 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 ...
37
votes
26answers
10k 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 ...
7
votes
7answers
366 views

The Microwave Challenge

Inspired by this comment. Input The number of seconds on the timer. Output Here's our basic microwave: ...
23
votes
6answers
2k views

128 years? Hypothetical leap year reform

The solar year is 365 days, 5 hours, 48 minutes, 45 seconds, and 138 milliseconds, according to this video. With the current Gregorian calendar, the rules for leap years are as follows: ...
44
votes
19answers
8k 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 ...