Questions tagged [date]
This challenge is intended to be solved by using, manipulating, accepting as input, outputting, or calculating calendar dates or clock times.
280
questions
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, ...
17
votes
5
answers
672
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
4
answers
440
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...
4
votes
2
answers
213
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 ...
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....
12
votes
26
answers
2k
views
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 ...
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 ...
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
...
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 ...
12
votes
3
answers
612
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 ...
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.
...
27
votes
3
answers
597
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 ...
19
votes
1
answer
2k
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
1
answer
493
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 ...
52
votes
19
answers
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
7
answers
771
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 ...
21
votes
8
answers
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
3
answers
438
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
4
answers
989
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 ...
27
votes
9
answers
672
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
5
answers
761
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
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 ...
20
votes
50
answers
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:
...
8
votes
2
answers
303
views
Output ISO8601 date
The Task
Given the positive value of unix timestamp output any of two valid ISO 8601 time formats:
YYYY-MM-DDTHH:mm:SS or, alternatively,
...
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 ...
16
votes
2
answers
768
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
21
answers
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
1
answer
292
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
1
answer
697
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
0
answers
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
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 ...
18
votes
9
answers
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
19
answers
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
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 ...
-5
votes
4
answers
271
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 ...
24
votes
4
answers
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 ...
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:
...
10
votes
2
answers
505
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
9
answers
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
0
answers
187
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
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....
21
votes
20
answers
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
9
answers
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 ...
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:
🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜�...
25
votes
13
answers
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
0
answers
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
12
answers
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
6
answers
845
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
6
answers
5k
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
3
answers
541
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 ...