Questions tagged [date]
This challenge is intended to be solved by using, manipulating, accepting as input, outputting, or calculating calendar dates or clock times.
280
questions
11
votes
3
answers
570
views
Write the date in abbreviated Latin
Inspired by How do you write dates in Latin?
Challenge
Given a month-and-day date, output that date in abbreviated Latin, as explained below.
Input
Input is flexible. You may choose to:
Take a date ...
14
votes
22
answers
2k
views
Decode the date in Christmas Eve format
This is the inverse of "Encode the date in Christmas Eve format."
Write a program that takes as input the string Christmas, possibly followed by ...
15
votes
19
answers
2k
views
Last Week Day Of The Month
Introduction
This challenge was inspired by a seemingly simple task requested at work that couldn't easily be done in Microsoft Teams. At least not from what we could find!
Task
Your task, if you ...
11
votes
6
answers
999
views
Spell date in Japanese
Objective
Given a date, spell it out in Romanized Japanese.
I/O Format
The input format is flexible. The output format is <month spelling> <day spelling>...
23
votes
43
answers
3k
views
Output each second
With roughly one second (plus or minus 10 ms) between outputs, output anything.
The first output must be at most one second after the start of the program, but can be as soon as right when the program ...
1
vote
4
answers
229
views
Get the date of the Nth day of week after the Xth day of week in a given year and month
Introduction
In the United States, national elections are normally held on the first Tuesday after the first Monday in November.
Challenge
Write a program that takes a Year as integer, and a pair of (...
9
votes
5
answers
427
views
Next Time Of Given Pattern
Introduction:
Some times using a 24-hour clock are formatted in a nice pattern. For these patterns, we'll have four different categories:
...
20
votes
31
answers
2k
views
Which weekday was it?
This challenge, I hope, is simple to understand. Given a date-string (given in any format you prefer, so long as it has 4 digits of year and 2 digits of day and month), calculate the weekday for the ...
18
votes
3
answers
810
views
Universal Unicode Clock
Plot contrivance
You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991.
You check the computer ...
5
votes
4
answers
704
views
Which Western Zodiac sign is today?
Task:
With the minimum amount of bytes, determine today's Zodiac sign using the programming language of your choice.
Rules:
This is code golf, the answer with the fewest characters wins. The ...
12
votes
6
answers
537
views
Implement OADD_MONTHS
Introduction
A function that adds months to a date (without overflowing ends of months) is implemented in many languages/packages. In Teradata SQL it's ADD_MONTHS, here are some examples:
...
14
votes
10
answers
941
views
Which Advent is it?
I know, a bit late.
Challenge
Your challenge is, given a date, output if it's not an Advent Sunday, or the Advent Sunday of the year.
Rules
The \$4^\text{th}\$ Advent is determined by the Sunday ...
66
votes
50
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 ...
16
votes
14
answers
2k
views
When's the Listening Party?
A listening party is an event where a bunch of people get together to listen to some music (like a viewing party, but for music). In the age of the internet you can do Listening Parties online with ...
11
votes
7
answers
941
views
Days of the Week
Create a function that accepts a list of dates (unsorted with possible duplicates) and returns the days of the week in one of the following formats:
A format similar to ...
1
vote
0
answers
69
views
Calculate the ISO week of Gregorian Easter [duplicate]
As in this question, your task – should you choose to accept it – is to calculate the date of Easter Sunday according to the Gregorian Computus (as used in the Catholic Church and most others) when ...
18
votes
32
answers
3k
views
Get the day of the year of a given date
Challenge
Given two positive integers \$1 \le m \le 12\$ and \$1\le d \le 31\$, representing a month and days into the month, output the amount of days that have passed since January 1st, on a non-...
14
votes
6
answers
512
views
When's my weekend finally here?
I like my job, but sometimes it can get a bit tedious and boring. As motivation, I want to know how many hours of work are left before I finally get my two days of weekend and relaxation.
I work ...
6
votes
5
answers
266
views
US Tax Due Dates
Introduction
In a standard* (e.g. not 2020) tax year, estimated payments are due quarterly according to the schedule outlined in Publication 505.
Payment Period
Due Date
January 1 – March 31
April ...
8
votes
5
answers
510
views
When will DST start / end
Daylight saving time (DST), is the practice of advancing clocks (typically by one hour) during warmer months so that darkness falls at a later clock time. The typical implementation of DST is to set ...
12
votes
8
answers
2k
views
Generate a British numberplate
Modern British number plates (a.k.a. registration marks or license plates) use the format AANNXXX where AA is a "DVLA ...
25
votes
24
answers
3k
views
Help me get the day of the week correct
Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday).
Your challenge is to display the number of days my estimates are off by.
...
19
votes
3
answers
2k
views
Calculate longest Stack Exchange streak
Introduction
This challenge is inspired by the Meta Stack Exchange question The longest consecutive days streak; it turns out that the URL ...
7
votes
25
answers
552
views
Which th second now in this year
In this challenge you have to find out which nth second it is now in this year, current date and time now. Or in other words, how many seconds have passed since New Year.
An example current Date is (...
23
votes
38
answers
5k
views
What year will it be in n seconds?
You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking ...
27
votes
16
answers
4k
views
How long till Halley's Comet returns?
Halley's Comet is the only comet that may appear (i.e. become visible to the naked eye on Earth) twice in a human lifetime. The orbital period of Halley's Comet is not constant: it has varied between ...
7
votes
13
answers
3k
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
10
answers
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
8
answers
4k
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 ...
15
votes
4
answers
1k
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
4
answers
544
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 ...
20
votes
35
answers
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 ...
6
votes
3
answers
263
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 ...
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 ...
18
votes
7
answers
2k
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 ...
25
votes
13
answers
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
19
answers
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
12
answers
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
6
answers
601
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 ...
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 ...
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 ...
7
votes
14
answers
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
17
answers
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
6
answers
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
4
answers
561
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 ...
21
votes
11
answers
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 ( ...
4
votes
7
answers
412
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
...
99
votes
54
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 ...
1
vote
1
answer
266
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 ...
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 ...