I've always been really amazed at how well strtotime works, but recently
ran into an issue where it couldn't figure out the date if it was a cc
exp date in long format, e.g. 1/2009. I was curious if anyone else has
run into this and how did they get around it, here was my solution:

function expDate2str( $date )
{
        if( !($sDate = strtotime( $date ) ) )
        {
                // exploded date
                $eDate = explode( '/', $date );
                
                // string date we hard code the day to 1
                $sDate = strtotime( date( "Y-m-d", mktime( 0, 0, 0,
$eDate[0], 1, $eDate[1] ) ) );
                
                
        }
        
        return $sDate;
}

Thanks, Mark

--------------------------------------------------------------
Mark Steudel
Web Applications Developer
555 Dayton St 
Suite A
Edmonds, WA 98020
p: 425.741.7014
e: [EMAIL PROTECTED]
w: http://www.netriver.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to