note 32552 deleted from function.mktime by sniper

From: Date: Tue, 04 Nov 2003 13:10:32 +0000
Subject: note 32552 deleted from function.mktime by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59870@lists.php.net to get a copy of this message
Note Submitter: l0rdphi1@liquefyr.com ---- If you're getting 'hour' in 12-hour format, you have to convert it to 24-hour format before you can use this function. The obvious answer would be to add 12 to every hour. But think again, adding 12 won't work. In 24-hour format the clock starts at 0, not 24. Thus after thinking it out you'd end up with something like this: if ( $am_or_pm == 'pm' ) { $hour = $hour == 12 ? $hour : $hour+12; } else { $hour = $hour == 12 ? 0 : $hour; } Hopefully that'll save someone some time at some point.. Good luck, l0rdphi1

« previous php.notes (#59870) next »