Questions tagged [date]
This challenge is intended to be solved by using, manipulating, accepting as input, outputting, or calculating calendar dates or clock times.
86
questions
30
votes
8
answers
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 ...
20
votes
26
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 ...
46
votes
78
answers
10k
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:
...
35
votes
38
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 ...
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 ...
66
votes
65
answers
9k
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.
...
15
votes
13
answers
2k
views
Decimal Time of Day Conversion
Introduction
Time is confusing. Sixty seconds to a minute, sixty minutes to an hour, twenty-four hours to a day (and not to mention that pesky am/pm!).
There's no room for such silliness nowadays, so ...
53
votes
52
answers
5k
views
I'm too cold, turn up the temperature
This is my first golf contest.
What you need to do
Build me, in the shortest amount of bytes possible, my AC remote control system. My room is too cold right now, and I'm missing my remote.
Now, I ...
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 ...
30
votes
22
answers
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 ...
22
votes
20
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 ...
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 ...
20
votes
12
answers
879
views
Change the Timezone
Challenge
Given a time and a timezone as input, output the time in that timezone.
Time
The time will be given in 24 hour format like so:
hh:mm
Where hh is the ...
15
votes
12
answers
1k
views
Day of the week of the next Feb 29th
Write a function which takes a date and returns the day of the week of the next February 29th after that date.
The input is a string in the ISO Extended format: YYYY-MM-DD (e.g. May 27th, 2010 would ...
13
votes
8
answers
2k
views
What is your star-sign?
Write a program that takes a birth date (month and day-of-month) as input and outputs the corresponding sign, element and quality of the western zodiac. For the purposes of this challenge, these are ...
12
votes
7
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 ...
11
votes
6
answers
5k
views
Calculate Chinese Zodiac sign
Given that the Chinese New Year is coming, here is a challenge to calculate the Chinese Zodiac, element and Taijitu for a given date.
The input should be a date:
...
103
votes
14
answers
11k
views
Has my milk expired?
Aww, man, this expiry date doesn't write the months with letters! I can't tell if it's expiring on March 10th or October 3rd... Wait, no, never mind, the year says 2012. (alley-oops half-used brick of ...
76
votes
41
answers
7k
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
...
69
votes
20
answers
7k
views
Automate Saving the World
You are Desmond Hume. For the last 3 years, you and your partner, Kelvin, have been slave to a computer that requires a very specific sequence to be entered into it every 108 minutes to save the world....
59
votes
13
answers
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 ...
55
votes
35
answers
7k
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
...
49
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 ...
45
votes
94
answers
5k
views
Output the Current Time
Challenge
You must output the current time continuously (until cancelled by an interrupt), once every second, by any of the following means:
It must be in 24-hour or AM/PM format.
If it is the ...
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 ...
28
votes
10
answers
2k
views
Alarm Optimization
My Alarm Clock
I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button ...
26
votes
19
answers
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 ...
15
votes
24
answers
2k
views
Next Friday the 13th
What is the shortest program that can predict the next time Friday will fall on the 13th day of the month?
Must be an complete functioning program (not just a function/subroutine)
Must print out date ...
15
votes
3
answers
743
views
Help me manage my time
I have been recently told to read an entire physics textbook by the new year (true story, unfortunately). I need your help to determine what chapters I should read each day. This is where you come in.
...
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 ...
9
votes
1
answer
492
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 ...
8
votes
9
answers
1k
views
What week is it?
The day of the week and month of the year seem to get a lot of attention but no one seems to care about the week of the year. I believe it's time to change that, so your job is to write a program or ...
4
votes
5
answers
3k
views
C: Output "tomorrow's date"
I'm a code golf novice, but I'm eager to give it a go.
My challenge is: Write the shortest program in C which takes in a date D as input and outputs the date ...
66
votes
14
answers
5k
views
Print a word clock
Since I saw the first one a few years ago, I always was subjugated by this kind of word clock where the time is actually spelled out by words being lit up or not into a meaningful sentence.
The text ...
47
votes
9
answers
3k
views
Read a date in xkcd notation
In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation:
The large numbers are all the digits that appear in the current date in their usual order, ...
42
votes
16
answers
7k
views
Use xkcd's formula to approximate the world population
In xkcd 1047, Randall Munroe lists "slightly wrong" approximations of assorted quantities and numbers with varying precision and complexity, such as that the number of liters in a gallon is very close ...
40
votes
28
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 ...
38
votes
28
answers
30k
views
When is Thanksgiving?
Background
Some holidays have fixed, easy-to-remember dates, like Oct 31, Dec 25, etc. Some, however, want to be troublesome. They're specified as things like "the first Monday in September" or "the ...
38
votes
34
answers
5k
views
Advance Happy New Year, 2016!
Your input will be a integer between 1970 and 2090 (inclusive), representing a year. Your program should output the next year on which New Years Day falls on the same day of the week as the input year....
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 ...
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
7
answers
2k
views
Compute the RFC 2550 timestamp
RFC 2550 is a satirical proposal (published on April 1, 1999) for a space-efficient ASCII representation of timestamps that can support any date (even those prior to the beginning of the universe and ...
29
votes
37
answers
8k
views
How many friday the 13th in a year?
Your challenge is to write a program which, given a year, outputs the number of "Friday 13ths" in it.
Rules & Details:
You can take input via STDIN, or as an ...
29
votes
39
answers
4k
views
The Last Monday
Monday, October 31st, is Halloween. And it got me thinking -- I wonder what other months have the last day of the month also be a Monday?
Input
A positive integer in any convenient format ...
28
votes
19
answers
5k
views
Leap for Leap Seconds!
Since today marks the occasion of the 26th leap second ever to occur, your challenge will be to output the date and time of every leap second in GMT or UTC that has occurred so far, as well as the one ...
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.
...
27
votes
11
answers
3k
views
Return the clock emoji closest to the current time when run
I can have a large if/else condition for each 30 minutes but I'm looking for more math and Unicode based solution.
Here are clock emojis:
🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜�...
26
votes
8
answers
1k
views
Convert a date to xkcd notation
In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation:
The large numbers are all the digits that appear in the current date in their usual order, ...
26
votes
37
answers
8k
views
Happy Rounded Pi Day
To celebrate Rounded Pi Day, you must take advantage of today's date to make a program that takes in a circle's diameter and outputs its circumference by multiplying the diameter by 3.1416, where 3....
25
votes
29
answers
5k
views
How many days in a month?
Given a textual representation (case-insensitive full name or 3 character abbreviation) of a month return the number of days in the month.
For example, december, <...