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
19
votes
1answer
1k 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 ...
16
votes
1answer
479 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 ...
51
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 ...
6
votes
7answers
739 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 ...
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 ...
21
votes
3answers
435 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 ...
21
votes
4answers
941 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
640 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: ...
12
votes
5answers
734 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 ...
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 ...
20
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: ...
37
votes
29answers
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 ...
16
votes
2answers
692 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
280 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
681 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: ...
1
vote
0answers
138 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 years....
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 ...
18
votes
9answers
2k 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
3k 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. ...
28
votes
19answers
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 ...
-4
votes
4answers
267 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 ...
25
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 ...
44
votes
72answers
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: ...
10
votes
2answers
486 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 ...
16
votes
9answers
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} ...
0
votes
0answers
185 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 ...
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....
21
votes
20answers
3k views

Find the last Sunday in every month of a given year

F# solutions known inside 140 chars, and this is a Rosetta Code problem. Required result on stdout or in a string variable for input year 2014: ...
18
votes
9answers
1k views

Sum the time durations

Challenge Write the shortest code that can sum all the time durations that appear in the stdin. The program must only consider the strings that match with one of the following patterns and ignore the ...
22
votes
5answers
2k 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: 🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜...
24
votes
13answers
4k views

It's Spanish Time!

I have a simple task that should be relatively easy to implement by means of code. Your goal is to write a program that will output the time written in Spanish, given the time in HH:MM format. Many ...
3
votes
0answers
2k views

The World in the Future [closed]

In the future, the world will change, there's no doubt about it. For that reason, you have to produce a realistic map of the world n years in the future. The ...
20
votes
12answers
3k views

Plug it back in tonight or this weekend

This is my first code golf so please let me know if it's too broad or if I'm missing any information for a good puzzle! Challenge In Ontario and possibly other areas of the world, electricity is ...
9
votes
6answers
802 views

Shortest script that gives the time passed since a Unix timestamp

What you need to do to win this challenge is to write the shortest "timeago" script that outputs the number of decades, years, weeks, days, hours, minutes, and seconds between a given Unix ...
54
votes
6answers
4k views

ASCII Art Calendar

Let's make an ASCII art clock and calendar that tells us the current month, day of the month, day of the week, hour, minute, and whether it's night or day (but not the year or second). At any ...
5
votes
3answers
526 views

When is my piversary?

Since I want to celebrate this definitely not nerdy event, your job is to calculate the piversary (pi-anniversary) of a given date. Input Your code has to have a possibilty to input a date in the ...
24
votes
21answers
3k views

When was the last time the date was divisible by n?

A date can be represented by an unsigned integer as such: YYYYMMDD. What you need to do, is write the shortest program or function that figures out the most recent date whose number was divisible by a ...
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 ...
24
votes
5answers
5k views

Shortest expression for {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}

Given list of integers {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}. For those who interested these numbers are used in weekday calculation. Weekday = ...
101
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 ...
14
votes
7answers
1k views

Minimalist Hex Clock

Your challenge is to create a clock that displays the time as a hex number, and the background color as the hex color code of the time. Requirements: No input. In the center of your output you ...
7
votes
2answers
676 views

Thwarting the Fry King

Setting The Fry King is a small criminal mastermind from the western european nation of Belgium, more specifically Flanders. He has acquired every single fastfood restaurant in a large part of ...
-4
votes
1answer
203 views

Longest code to reduce words [closed]

Write a code in your favorite language which reduces words To first three characters. ...
6
votes
7answers
862 views

Print the time in a digital watch [duplicate]

Write a program that prints the current time in a digital watch. Rules: The program must use the local timezone. Time is expressed between 00:00 to 23:59 (with only hours and minutes). The program ...
13
votes
11answers
1k views

Find all times that follow a pattern

Your job is write a program that prints all times (in the format HH:MM, 24 hours) that follow any of the following patterns: Hours equal to minutes, e.g. 22:22,01:01 Hours equal to reverse minutes, e....
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: ...
9
votes
4answers
654 views

Find the next "interesting" time

I happened to glance at my watch today at exactly 11:11:11 (and today is 1/11; too bad it's not 2011), and that got me thinking: I know! I should make a code golf question out of this! I'm a dork. ...
0
votes
2answers
142 views

Party all week end for my birthday? [duplicate]

Knowing a given date (11/28/1973), and supposing I will die when I'm 99, what are the years when my birthday will be a thursday so that I will be able to party all ...
28
votes
32answers
7k 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 ...