This challenge is intended to be solved by using, manipulating, accepting as input, outputting, or calculating calendar dates or clock times.

learn more… | top users | synonyms (3)

-2
votes
0answers
49 views

Determine if a given loan repayment schedule is a weekly or a daily schedule? [closed]

Its a real life problem which I recently fixed with >90% accuracy but wants to know if there can be 100% accurate result. You are given a set of repayment schedules, some of which represents a daily ...
0
votes
0answers
76 views

Convert string to time

This challenge is inspired by this other. The challenge Write a program or a function in any programming language that given as input a string representing a time in English (see below, for further ...
15
votes
6answers
304 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 you head, and confesses he has a severe case of ...
8
votes
4answers
357 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 ...
14
votes
9answers
443 views

Next public holiday

Australians love public holidays, and drinking. Yesterday, the 26th January, was Australia day, which is a public holiday. I was glad to not be at work yesterday, and eager to know the next time I get ...
10
votes
1answer
268 views

Calculate the Lunar Phase

Introduction tl;dr In this challenge you have to calculate the moon's phase for a given date. This challenge is inspired by the game psycho social audiovisual experiment "Superbrothers: Sword ...
10
votes
3answers
294 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 ...
15
votes
11answers
1k views

Pi Day, Pi Minute, or Pi Second?

In this challenge you will need to determine whether it's Pi Day, Pi Minute, or Pi Second. Because Pi is irrational, it wants your code to be as short as possible. Examples No input is provided, ...
8
votes
14answers
407 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 ...
16
votes
2answers
308 views

Forgotten Realms date calculator

In an effort to level the playing field between languages with built-in date libraries and those without, let's work with a fictional calendar. The Forgotten Realms are a (the?) campaign setting for ...
1
vote
5answers
100 views

Parrot User’s Delay [duplicate]

A simple code golf challenge similar to an already existing, but more complex one: Wait for user to press enter. Wait for user to press enter again. Print the elapsed time between the 1. and 2. Wait ...
40
votes
7answers
2k 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 ...
22
votes
7answers
468 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 ...
17
votes
6answers
419 views

Rollover Calendar

This is inspired by one of Downgoat's questions in Sandbox, where I suggested that he include April 31 as Pi day for people who use day/month format, only for him to inform me that there is no April ...
13
votes
4answers
376 views

How many weeks?

Your task is to output a single number; the number of ISO weeks that a given date range intersects. To quote Wikipedia: An average year is exactly 52.1775 weeks long, but this is not about the ...
3
votes
2answers
174 views

Create a Winter Bash 2015 hat reminder

Input Two dates, each comprising of a month (Dec or Jan) and a day (01-31). These will be given as 4 integers (12 01 01 01, for example), in any reasonable format you choose (leading zeroes, no ...
37
votes
31answers
4k 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 ...
10
votes
20answers
2k views

How long ago was this?

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 that has ...
34
votes
64answers
3k 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 ...
44
votes
22answers
4k 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 Legen... wait for it... immediately, ...
37
votes
27answers
4k 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 ...
9
votes
2answers
274 views

Festival of ASCII-art lights

Write, in as few characters as possible, a program that takes zero or six command-line arguments menorah menorah YEAR MONTH DAY HOUR MINUTE SECOND (Both forms must be supported. The zero-argument ...
13
votes
3answers
468 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. ...
22
votes
3answers
390 views

Combined 100 year birthday

I was recently adding up the ages of myself and my wife and kids and realised that at some point in the not-too-distant future our ages will all add up to exactly 100 years. Challenge For an input ...
13
votes
0answers
292 views

Make a math equation from the date

In my Economics class, my friends and I like to come up with ways to rearrange the digits in the date (in MM/DD/YY) format to create a valid mathematical equation. For the most part, we are allowed to ...
11
votes
1answer
202 views

Which Ubuntu versions are supported?

Given an input date, your entry will output the full list of supported versions of the Ubuntu Linux distro on that date. The full list of all releases is as follows: Version Code name ...
48
votes
19answers
6k views

Detect Time Travel

Computers are everywhere nowadays - in cars, trains, skateboards, even nuclear reactors. The possibility that your software will run in a time travelling device is just a matter of time. Can you deal ...
5
votes
5answers
532 views

Arbitrary Clock Time Calculator

Create a routine to calculate the position of each unit of a clock with an arbitrary number of units (minutes, hours, half-days, days, years, parsecs, quarter-quells, etc), where each unit can be ...
17
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 ...
21
votes
3answers
387 views

Perform a Pluto flyby

Congratulations! You've just been hired by NASA to work on the new Horizons 2 project. Sadly, there have been huge budget cuts recently, so the top management has decided to fake the whole planned ...
19
votes
4answers
560 views

Telling time in French

Bonjour, PPCG ! Quelle heure est-il ? This means what time is it in French, for that is exactly what this challenge is about. Telling time in French (at least formally) is a bit different from ...
24
votes
7answers
527 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: 1. Everything in Its Right Place - 4:11 2. Kid A - ...
9
votes
3answers
520 views

See you in another life, brotha!

Most of us LOST fans out there remember the computer that Desmond had to type the characters "4 8 15 16 23 42" in every 108 minutes or the world would end (or would it?). The challenge here is to ...
41
votes
16answers
5k 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 ...
16
votes
45answers
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: Run code.... ...
10
votes
1answer
357 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 ...
34
votes
21answers
3k views

What day is it (on Flooptonia)?

You are a space tourist on your way to planet Flooptonia! The flight is going to take another 47,315 years, so to pass the time before you're cryogenically frozen you decide to write a program to help ...
6
votes
1answer
168 views

Transit all day every day

In addition to contributing to Stack Overflow and other SE sites, I like to ride public transit during my free time. I'd be spending a fortune on cash fare and/or bus tickets every month if I didn't ...
5
votes
1answer
198 views

Most efficient table storage for determining recurrence

The goal of this challenge is to implement a storage and retrieval pattern that will most quickly determine if a set of recurrence definitions fall within a date range. Consider the schema: Event ...
1
vote
0answers
121 views

The Venerable Bede, 21st Century Style [duplicate]

1300 years ago, the English theologian Bede earned the honorific by which he is now known ("The Venerable Bede") by, among other things, convincingly computing the date of Easter for a number of ...
11
votes
10answers
601 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, ...
17
votes
9answers
1k views

Incremental Game Time Format

Incremental Game Time Format Goal Incremental games often have a countdown timer expressing the days, hours, minutes and seconds until a task is complete. Depending on the space available, they can ...
28
votes
19answers
2k views

Format microseconds as hours:minutes:seconds, etc

The following is inspired by a question that came up on Stack Overflow today. Given a number of microseconds, 0 <= n <= 86400000000 (e.g. 12345678900), output a formatted string ...
27
votes
19answers
4k 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 ...
-5
votes
4answers
216 views

Workweek completion

I work from Monday to Friday. I start my day at 8:12 and have lunch from 12:00 to 12:42. My workday ends at 16:30. If you are wondering why 8:12 and 12:42: 8:00 is the goal, but I never actually ...
23
votes
4answers
2k views

What's the time?

I like to save time quite literally, by wearing three watches on my wrist... Problem is they each give a different time. One watch is x minutes behind the actual time. One watch is x minutes ahead of ...
22
votes
24answers
3k views

Counting leap years

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: 1954 You ...
9
votes
1answer
301 views

What date is that again?

On my website, users enter their date of birth in the style xx.xx.xx - three two-digit numbers separated by dots. Unfortunately, I forgot to tell the users exactly which format to use. All I know is ...
16
votes
8answers
1k views

Convert human readable time interval to date components

Challenge Write the shortest program that converts a human readable time interval to date components of the form: {±YEARS|±MONTHS|±DAYS|±HOURS|±MINUTES|±SECONDS} Sample cases Each test case is ...
0
votes
0answers
169 views

Rise and Shine! [duplicate]

Challenge The challenge is to create a program which takes a date, a latitude, and a longitude, and prints the time of the sunrise on that date for the given location. The program must work for any ...