Questions tagged [date]
This challenge is intended to be solved by using, manipulating, accepting as input, outputting, or calculating calendar dates or clock times.
292 questions
15
votes
10
answers
4k
views
Verify a Chinese ID Number
Verify a Chinese ID Number
The Resident Identity Card (居民身份证) is a document issued to most Chinese citizens. It contains information about its holder, including their name, address, and ID number, an ...
-4
votes
3
answers
231
views
Write a program that shows the time until the expiration of Trump's presidential term in milliseconds [closed]
The RULES
Each submission must be a full program.
The program takes no input and prints the time in milliseconds until Trump leaves office to the standard output. So pretty much the title. Write a ...
16
votes
12
answers
4k
views
A broken clock is right n times a day
You will be provided with a string containing a digital clock. You must determine how many times per day that clock could be correct. You can ignore daylight savings time. You do not know if the clock ...
17
votes
6
answers
2k
views
When is my coworker's next birthday?
inspired by this post.
Consider 2 coworkers who work Monday - Friday, every week of every year, with no breaks or national holidays.
On day n (day, month and year), worker 1 asks worker 2 their ...
14
votes
19
answers
3k
views
Antiparallel 12-hour Clock Hands
Output (or print) each of the 11 times, one per line, in the POSIX %I:%M:%S format, at which the hour and minute hands of a 12-hour clock are antiparallel. Here <...
7
votes
9
answers
2k
views
Where is it midnight?
With the passing of ex-president Jimmy Carter, a meme twitter account titled "Did Jimmy Carter Die Today?" erroneously tweeted the usual "No":
Some commenters argued that the post ...
11
votes
13
answers
2k
views
When is Daylight Saving Time?
In the United States, Daylight Saving Time starts on the second Sunday of March, and ends on the first Sunday of November.
Write the shortest full program, function, or code snippet that does the ...
-1
votes
3
answers
261
views
Find a datetime that works for everyone
Given a list of datetime ranges, write the shortest program/function/code snippet that returns a single datetime that is within all ranges, or some falsey value if no such datetime exists, i.e. a ...
22
votes
2
answers
2k
views
Fast leap year check
The task is to find parameters that make a fast leap year check correct for the widest range of years.
We assume the Proleptic Gregorian calendar, which extends the Gregorian calendar backward from ...
17
votes
13
answers
3k
views
Is it a date format of YYMMDD, MMDDYY, and/or DDMMYY?
The date format varies between countries; the arrangement of date, month and year can be categorized into these three:
Year-month-date
Month-date-year
Date-month-year
In Gregorian calendar it's year ...
16
votes
7
answers
5k
views
How many people are awake?
The following data contains the (approximate) population of each UTC timezone in the world (source):
...
12
votes
10
answers
2k
views
Format Datetime in 30-Hour Clock Time
Input a datetime, format the datetime in YYYY-MM-DD HH:mm:ss format using 30-hour clock time.
The 30-hour clock time works as:
After 6 a.m., it is same as 24-hour ...
7
votes
6
answers
469
views
Output 5-line calendar
Given year, month and optionally weekday of 1st, output the calendar of the month. The first week should remain nonempty.
For empty cell, fill it with the date where it's supposed to be, in last or ...
11
votes
3
answers
689
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, following conventions from other ...
14
votes
22
answers
3k
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 ...