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
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 ...
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 ...
43
votes
71answers
8k 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: ...
33
votes
38answers
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 ...
14
votes
8answers
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 ...
15
votes
13answers
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
53answers
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 ...
10
votes
6answers
4k 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: ...
36
votes
28answers
8k 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 ...
20
votes
12answers
842 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 ...
29
votes
22answers
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 ...
14
votes
12answers
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 ...
12
votes
7answers
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 ...
20
votes
6answers
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 ...
99
votes
14answers
10k 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 ...
69
votes
20answers
6k 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....
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 ...
56
votes
54answers
7k 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. ...
29
votes
24answers
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 ...
46
votes
89answers
4k 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 ...
72
votes
40answers
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 ...
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 ...
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 ...
15
votes
3answers
731 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. ...
13
votes
8answers
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 ...
11
votes
12answers
1k 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 ...
28
votes
10answers
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 ...
20
votes
8answers
2k views

Find our missing dead

Challenge Peter has risen again to save us from the duplicate challenges! Peter Taylor is dead, and there's no doubt about it (well, apart from the huge amount of doubt we have... but just ignore ...
15
votes
24answers
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 ...
9
votes
1answer
468 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
9answers
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
5answers
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 ...
59
votes
13answers
4k 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 ...
26
votes
8answers
944 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, ...
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 ...
48
votes
9answers
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
16answers
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 ...
38
votes
28answers
29k 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 ...
37
votes
26answers
10k 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
29answers
4k 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, <...
28
votes
7answers
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 ...
16
votes
2answers
674 views

ValiDate ISO 8601 by RX

Challenge Find the shortest regex that validates, i.e. matches, every possible date in the Proleptic Gregorian calendar (which also applies to all dates before its first adoption in 1582) and does ...
39
votes
32answers
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....
28
votes
32answers
6k 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 ...
25
votes
36answers
5k views

Ring me when our cup noodles are ready [duplicate]

I'm currently cooking us some cup noodles, but we're really sleepy at the moment. They'll be finished in 50 seconds from now, can you wake me up then? Problem: Write a program or function that waits ...
25
votes
37answers
7k 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....
19
votes
48answers
3k views

What's the time, chap?

I honestly cannot believe that this is not a question yet on Code Golf, but.... Print the local time (with a.m. or p.m.) as a string to the console, preceded by "It's ". Example: ...
16
votes
15answers
1k views

Plan your Sundays!

Who doesn't like to chill on a Sunday morning in summer with a chilled beer and TV or in winter playing badminton or ultimate with friends? I always think knowing how many days you have to chill in a ...
12
votes
7answers
1k views

Calculate the day number of the year

Seems like we do not have this one yet, so here we go: The Challenge Write a program or function that takes a date as input and outputs the day number of the year. You may not use any builtins for ...
42
votes
48answers
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 ...