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
26 votes
9 answers
666 views

Track listings to time tables

Introduction Don't you hate it when someone uploads an album you like to YouTube, but the description only contains a track listing? Like this: ...
15 votes
3 answers
615 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 ...
19 votes
8 answers
758 views

Convert the Time to a String

Problem One day, you boss walks up to you and tells you he needs to know the time. He still insists after you pointing at the clock directly above your head, and confesses he has a severe case of ...
92 votes
51 answers
17k 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 ...
8 votes
16 answers
1k views

Calculate Swatch Internet Time

Output the current time of day as Swatch Internet Time. Specifically, output a three-digit (zero-padded) number of ".beats" (1000ths of a day) which represent the current time of day in the Swatch ...
39 votes
27 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 ...
25 votes
36 answers
4k views

It's time for a clock challenge!

I'd like you to build me a clock that displays time in this format: 18 ---------- 19 -------------------------------------------------- This displays '18:10'. The ...
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 ...
5 votes
4 answers
615 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 ...
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 ...
62 votes
61 answers
8k 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. ...
12 votes
6 answers
448 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: ...
19 votes
25 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 ...
12 votes
8 answers
1k views

What's the day today (or other dates)?

Task Write a program or a function that calculates a week-day name of a date which a user inputs. Input & Output Input is a string, YYYYMMDD. Example of ...
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 ...
44 votes
72 answers
9k 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: ...
14 votes
10 answers
925 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 ...
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 ...
75 votes
41 answers
6k 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 ...
59 votes
47 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 ...
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 ...
48 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 ...
23 votes
37 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 ...
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 ...
11 votes
16 answers
772 views

Chinese Zodiac of the year

2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year. Because ...
28 votes
67 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 ...
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. ...
78 votes
37 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 ...
22 votes
21 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 ...
8 votes
5 answers
473 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 ...
11 votes
7 answers
767 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 ...
18 votes
31 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-...
1 vote
0 answers
62 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 ...
14 votes
6 answers
506 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 ...
7 votes
8 answers
583 views

Output: Calendar Month (without native calendar generating functions)

Upon receiving month and year in YYYYMM format, generate output of the corresponding calendar month for that year. For example the input 201312 should generate ...
6 votes
5 answers
260 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 ...
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 ...
34 votes
36 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 ...
7 votes
25 answers
534 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 (...
25 votes
24 answers
2k 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. ...
32 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 ...
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 ...
12 votes
6 answers
1k views

Compute the difference between two days.

Another date-manipulating problem :P Task Write a program or a function that calculates the difference between two dates given by a user. Input & Output Similar to the previous one, inputs ...
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 ...
12 votes
26 answers
2k views

How long ago was this?

The Rules Each submission must be a full program. The program must take input as two comma-separated dates in the form YYYY-MM-DD, and print the number of days ...
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 ...
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 ...
15 votes
9 answers
2k views

Calculate the date of Easter

Your function or program should take a year as input and return (or print) the date (in the Gregorian calendar) of that years Easter (not the Eastern Orthodox Easter). The date returned should be ...
20 votes
6 answers
1k views

Superstitious Programming

Your challenge is extremely simple. Given a year as input, print all the months in that year that will contain a Friday the 13th according to the Gregorian calendar. Note that even though the ...
49 votes
23 answers
9k 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 ...

1
2 3 4 5 6