Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006
    Posts
    3

    Unanswered: php and mysql dates

    I am trying to use date_format on data that I am pulling from the database...the result is showing as blank space. Any thoughts, also I am having problems with the encode and decode functions...

  2. #2
    Join Date
    Jan 2005
    Posts
    68

    format mysql date

    I use this function to format mysql dates:

    function format_mysql_date($date){
    $date_parts=explode(' ',$date);
    $arr_date=explode('-',$date_parts[0]);
    $date=$arr_date[1].'/'.$arr_date[2].'/'.$arr_date[0];

    //check for today
    $today=getdate();
    if(($arr_date[1]==$today['mon'])&&($arr_date[2]==$today['mday'])&&($arr_date[0]==$today['year'])){
    $date="Today";
    }

    $time=format_time($date_parts[1]);
    return $date." ".$time;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •