SimpleDateFormat.php - parse/format dates in PHP - download and use it!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • siarsky

    SimpleDateFormat.php - parse/format dates in PHP - download and use it!

    Do you know SimpleDateForma t from Java? I was missing this class a lot,
    so I wrote a PHP version:

    include_once 'SimpleDateForm at.php';
    $input_format = new SimpleDateForma t('dd.MM.yyyy HH:mm:ss'); //Europe standard
    $output_format = new SimpleDateForma t('yyyy-MM-dd HH:mm:ss'); //mySql standard
    $input_date = '29.2.2000 14:33:57';
    $date = $input_format->parse($input_d ate);
    if ($date != ""){
    //date is valid
    $output_date = $output_format->format($date );
    }
    else {
    //date is invalid
    }

    For more see http://www.siarsky.ch/php/SimpleDateFormat.html
  • R. Rajesh Jeba Anbiah

    #2
    Re: SimpleDateForma t.php - parse/format dates in PHP - download and use it!

    siarsky@usa.com (siarsky) wrote in message news:<cf3f8310. 0401111513.457d 5d20@posting.go ogle.com>...[color=blue]
    > Do you know SimpleDateForma t from Java? I was missing this class a lot,
    > so I wrote a PHP version:[/color]

    If you don't mind, already someone did that...
    <http://www.phpinsider. com/php/code/Date_Calc/>

    --
    http://www.akbkhome.com/resume/ - This is Allan's resume. I couldn't
    help him; but you may be...
    Happy Pongal holidays!
    Email: rrjanbiah-at-Y!com

    Comment

    Working...