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
6
votes
12answers
611 views

Output ISO8601 date string from seconds and nanoseconds

One reason why ISO8601 is the best date string format, is that you can simply append as much precision as you like. Given 2 integers representing seconds and nanoseconds that have passed since ...
15
votes
10answers
2k views

When does hh:mm = mm.ss?

Let's begin with a thought experiment. You have a clock and a timer, in which you start the timer when the clock shows exactly hh:mm.00. Clock: The clock employs ...
-1
votes
8answers
1k views

Make a Ramanujan magic square

Background As you maybe know Ramanujan made this magic square by \$4x4\$ Matrix: This works like all magic squares. But the special thing in this square is that his birthdate is hidden in the first ...
14
votes
4answers
867 views

Eight days a week

Back in 1965, The Beatles released their hit song 'Eight Days a Week'. In this code-golf challenge we are going to reimagine dates of the 21st century as if there really were eight days a week. Input ...
8
votes
4answers
480 views

Find the date that is n days from January 1st 1984

This challenge is a relatively simple concept that I'm surprised has not been done yet. You will be given only an integer as an input. Your task is to find the date that is this number of days from ...
19
votes
29answers
3k views

Does this month start on a Monday?

June 2020 is a month in which June 1st corresponds to Monday, June 2nd corresponds to Tuesday, ... June 7th corresponds to Sunday. For reference, here's the cal of ...
5
votes
3answers
231 views

Can I trade today?

Back in 2018, there has been introduced new law in Poland to ban trading on sundays, but certain exceptions have been made (listed below). The task today is to determine, can one trade on the sunday ...
30
votes
34answers
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 ...
15
votes
6answers
1k views

When is the closest Conway's Doomsday?

A quote from MO.SE answer: Although it is well known that Conway was able to quickly calculate the day of the week of any given date, it is less well known that one part of the algorithm is easy to ...
24
votes
13answers
5k views

Is this a legal date? - April Fools' edition

Task A date can be compactly represented in a 6-character string in the format ddmmyy where the first two characters (dd) ...
22
votes
19answers
4k views

Even a clock that isn't working gets the time right two or three times a day

Context When I was a little kid, I watched a Disney movie where Goofy told his son "Boy, even a broken clock is right two or three times a day." (see this youtube clip, courtesy of @Arnauld). ...
17
votes
12answers
1k views

Day of the week of an ambiguous date

Goal Write a program or function that returns the day of the week for a date, eg. 01/06/2020 -> Mon However, it's unknown if the date is in the format mm/...
9
votes
6answers
534 views

Pairs of palindromic anagramic dates separated by a palindromic number of days

Definitions: A palindrome is a string which reads the same backward or forward (not counting spaces or special characters), such as "madam" or "Sorel Eros". A date is said to be a palindrome when ...
29
votes
41answers
6k 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 ...
33
votes
12answers
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 ...
7
votes
14answers
2k views

Print out execution time of program [closed]

Challenge Write a complete program that prints out the time it took to execute a certain part of itself. That part must include a process whose total number of operations (and therefore execution ...
12
votes
17answers
3k views

How many ACUs do I have?

Posted from sandbox The Intro What is an ACU? This challenge is based on the concept of money and since this is an international community, we all use different currencies, so in keeping with our ...
16
votes
6answers
3k views

What's the Mayan date?

Just over seven years ago, everybody suddenly stopped talking about the Maya people. It is time to rectify that! For clarification, I am talking about the Mesoamerican Long Count Calendar. Your ...
10
votes
4answers
510 views

When is Hannukah?

Input The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars ...
18
votes
11answers
3k views

Advent calendar

Let's build an advent Calendar for this Christmas! Many Advent calendars for children take the form of a large rectangular card with numbered windows for each day of December starting from 1 ( ...
3
votes
8answers
382 views

Give me the first day of next month

Simple question! Given a string that contains a date in ISO8601 format, print the first of the next month in ISO8601 format. Example inputs: 2018-05-06 ...
86
votes
45answers
16k views

Sleep for 1000 years

Some sleep commands implement a delay of an integer number of seconds. However, 232 seconds is only about 100 years. Bug! What if you need a larger delay? Make a ...
1
vote
1answer
255 views

Find all possible dates [closed]

You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but ...
25
votes
34answers
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 ...
16
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 ...
2
votes
0answers
147 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 ...
58
votes
13answers
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 ...
6
votes
19answers
610 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] + ...
23
votes
5answers
569 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 ...
8
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 ...
24
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 ...
-1
votes
14answers
563 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 ...
-6
votes
10answers
243 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
778 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
350 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
2k 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
598 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
4k 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 ...
51
votes
29answers
6k 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
1k 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 ...
18
votes
25answers
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 ...
4
votes
4answers
395 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
2k 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 ...
24
votes
8answers
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 ...

1
2 3 4 5 6