# 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
Filter by
Sorted by
Tagged with
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 ...
• 3,580
2k views

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 ...
• 71.8k
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 = ...
• 2,663
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 ...
• 8,696
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 ...
• 11.5k
694 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 ...
• 501
218 views

### Longest code to reduce words [closed]

Write a code in your favorite language which reduces words To first three characters. ...
• 2,703
891 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 ...
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....
• 298
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: ...
• 1,959
657 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. ...
• 71.4k
143 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 ...
• 101
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 ...
• 2,275
599 views

### Output: Calendar Month (without native calendar generating functions)

Upon receiving month and year in YYYYMM format, generate output of the corresponding calendar month for that year. For example the input 201312 should generate ...
• 7,493
230 views

### Relative dates in words

Given a specific date, have the code output a relative reference: If the date entered is ahead of the current date, express as "x days from now" or "x weeks, y days from now", or "x years, y weeks, z ...
• 7,493
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 ...
• 3,316
345 views

### Merge working time periods

You have an array of working time period pairs (from, till) received from user input and written according 24-hour clock format convention. You have to merge these periods if the intersect each ...
• 111
699 views

### Working Week Completion

I work a standard nine to five. Monday through Friday. I take a half hour for lunch from 12:30 to 13:00. Write me a program which, when run, calculates the percentage of the working week that I have ...
• 4,365
1k views

### Day of the week for a given date of this year. Do not use any date tools [duplicate]

Please write a program that takes as input two numbers 'day of the month' and 'month number' for any day of this year (2012) and outputs day of the week. Examples: ...
• 1,778
1k views

### How long until this date?

The idea is this: Write a function to print the length of time from now/today's date (at the time the function is called) until a date supplied as an argument. Assumptions: Input date will always be ...
• 3,597
852 views

### Convert __DATE__-style string to sortable string

Goal is to write the shortest possible C89 and C99-compliant single-module C program which will compute and print out a single-line string whose sort order will correspond with the date given by the ...
• 313
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 ...
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 ...
• 4,735
1k views

### Compute the difference between two days.

Another date-manipulating problem :P Task Write a program or a function that calculates the difference between two dates given by a user. Input & Output Similar to the previous one, inputs ...
• 3,472
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 ...
• 3,472
3k views

### The Time Traveler

The shortest code to generate the correct times on the clocks wins. You are a seasoned time traveler and have been known to stop at many planets during your journies. Each planet rotates at a ...
• 6,442
3k views

### Draw a BCD Binary clock

Create a BCD binary clock in ASCII. As implied, it shall display time in six columns of dots: (source: Wikimedia Commons) Each column is a binary-coded digit, reading hours, minutes and seconds ...
• 12.9k
1k views

### Percentage of work days in a month

Given a year and a month, find out the percentage of work days in said month. Work days are Monday through Friday with no regard to holidays or other special things. The Gregorian calendar is used. ...
• 12.9k