|
7:40:44 AM
Thursday
Sep 09
| Su | M | Tu | W | Th | F | Sa |
|---|
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 1 | 2 |
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Play My Typing Game View Some of My Artwork | How old I am I just happen to know I was born at 1:25pm on my birthday. This solution works, but a little funny. I'm specifying that there are 365.251 days in a year because my 6th grade math teacher taught me so (every hundred years an additional leap day occurs and February has 30 days.
<? $bday = mktime(13,25,0,7,25,1979);
$calc = time()-$bday;
$years = floor($calc/60/60/24/365.251); $cdr = (($calc/60/60/24/365.251)-floor($calc/60/60/24/365.251)); $months = floor(12*$cdr); $cdr = (12*$cdr)-floor(12*$cdr); $days = floor(30.5*$cdr); $cdr = (30.5*$cdr)-floor(30.5*$cdr); // cheap math, averaging 31 days to 30.5 $hours = floor(24*$cdr); $cdr = (24*$cdr)-floor(24*$cdr); $mins = floor(60*$cdr); $cdr = (60*$cdr)-floor(60*$cdr); $secs = floor(60*$cdr); echo "I am ".$years." years, ".$months." months, ".$days." days, ".$hours." hours, ".$mins.", minutes, ".$secs." seconds old... and completely fascinated by life."; ?>
Ok, so the code above is fairly ugly. The following is something I found in at php.net by jason at thinking man. Its lengthy, but concise.
<?php define('INT_SECOND', 1); define('INT_MINUTE', 60); define('INT_HOUR', 3600); define('INT_DAY', 86400); define('INT_WEEK', 604800);
function get_formatted_timediff($then, $now = false) { $now = (!$now) ? time() : $now; $timediff = ($now - $then); $weeks = (int) intval($timediff / INT_WEEK); $timediff = (int) intval($timediff - (INT_WEEK * $weeks)); $days = (int) intval($timediff / INT_DAY); $timediff = (int) intval($timediff - (INT_DAY * $days)); $hours = (int) intval($timediff / INT_HOUR); $timediff = (int) intval($timediff - (INT_HOUR * $hours)); $mins = (int) intval($timediff / INT_MINUTE); $timediff = (int) intval($timediff - (INT_MINUTE * $mins)); $sec = (int) intval($timediff / INT_SECOND); $timediff = (int) intval($timediff - ($sec * INT_SECOND));
$str = ''; if ( $weeks ) { $str .= intval($weeks); $str .= ($weeks > 1) ? ' weeks' : ' week'; }
if ( $days ) { $str .= ($str) ? ', ' : ''; $str .= intval($days); $str .= ($days > 1) ? ' days' : ' day'; }
if ( $hours ) { $str .= ($str) ? ', ' : ''; $str .= intval($hours); $str .= ($hours > 1) ? ' hours' : ' hour'; }
if ( $mins ) { $str .= ($str) ? ', ' : ''; $str .= intval($mins); $str .= ($mins > 1) ? ' minutes' : ' minute'; }
if ( $sec ) { $str .= ($str) ? ', ' : ''; $str .= intval($sec); $str .= ($sec > 1) ? ' seconds' : ' second'; } if ( !$weeks && !$days && !$hours && !$mins && !$sec ) { $str .= '0 seconds ago'; } else { $str .= ' ago'; } return $str; } ?>
Table of ContentsMy Background in Computing HTML & XHTML CSS PHP MySQL JavaScript Complete Applications bash Apache / .htaccess Regex Adobe Flex Coldfusion
Give a listen to my music...
How my services and skills can help you:
- Global (via Email/Skype/AIM(ichat)/Yahoo)
- Web Development Consulting
- Custom Web App Development (PHP/MySQL/jQuery/CSS) Cross-Browser & OS
- Cellphone App Development (Android/MobileWeb)
- Music Lessons & Education for Beginner Guitar, Piano, Bass, which transfers over to many other instruments I am comfortable playing but not yet at teaching.
- Music - Soundtrack Composition & Voice Work
- Local
- Most all the above, but also:
- Music Performance (Harp, Voice, Guitar, Piano, Bass, Latin Percussion)
- Recording Live Music Audio
- Video Streaming live music and other live events anywhere that can provide wifi
- Training Video Streaming to your venue's trusted soundperson
|
Skills:
- Global (via Email/Skype/AIM(ichat)/Yahoo)
- Web Development Consulting
- Custom Web App Development (PHP/MySQL/jQuery/CSS) Cross-Browser & OS
- Cellphone App Development (Android/MobileWeb)
- Music Lessons & Education for Beginner Guitar, Piano, Bass, which transfers over to many other instruments I am comfortable playing but not yet at teaching.
- Music - Soundtrack Composition & Voice Work
- Local, Most all the above, but also:
- Music Performance (Harp, Voice, Guitar, Piano, Bass, Latin Percussion)
- Being your venue's soundman
- Video Streaming live music and other live events anywhere that can provide wifi
- Training Video Streaming to your venue's trusted soundperson
|