Skip to content

Instantly share code, notes, and snippets.

@andrewwoods
Last active July 10, 2017 22:32
Show Gist options
  • Save andrewwoods/fb136702120a212a1fd797c75e096cab to your computer and use it in GitHub Desktop.
Save andrewwoods/fb136702120a212a1fd797c75e096cab to your computer and use it in GitHub Desktop.
30 Hour days

30 Hour Days

I want to change the world, but they won't give the source code :)

People try hard to accomplish things on their to-do list, but they often feel like they don't have enough time. To anyone who has been on Twitter long enough, you'll eventually come across a tweet similar to the following:

ZOMG! I need more time! How can I stretch out the number of hours in a day to 30 hours!

The desired number of hours in the tweets usually differs, but the sentiment remains the same. Let's see how we can do that!

Here's what we know

  • There are 60 seconds in a minute
  • There are 60 minutes in an hour
  • There are 24 hours in a day

In PHP, it's defined as:

define('MINUTE_IN_SECONDS', 60);

define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS);

define('DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS);

The easiest thing to do is update the value for the DAY_IN_SECONDS constant

define('MINUTE_IN_SECONDS', 60);

define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS);

define('DAY_IN_SECONDS', 30 * HOUR_IN_SECONDS);

What if, instead, we wanted to change the number seconds in a minute, so that we didn't have to change the number of hours in a day. Perhaps, because we happen to like the idea of 24 hours in a day.

The traditional 24-hour day has 86,400 seconds. The new day has 108,000 seconds.

The difference between them is 6 hours, or 21,600 seconds. 108,000 seconds / 24 hours / 60 minutes = 75 seconds per minute.

define('MINUTE_IN_SECONDS', 75);

define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS);

define('DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS);

And that ladies and gentlemen, is how you can get a 30 hour day!

Happy Computing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment