Jump to content

date conversion from mysql


diasansley

Recommended Posts

hey guys the date stored in mysql is yyyy-mm-dd i need to convert it to do a string compare i have used the following

 

$query = "SELECT * FROM booking where id=$sel"; 
            $result = mysql_query($query);
           while ($row = mysql_fetch_array($result))
           { $num1=$row['no_rooms'];
               $from1=$row['from'];
               $to=$row['to'];
               $sel1=$row['room_type'];
               $date = date('d-m-y', strtotime($from1)); 
             
              }
                 echo "$date";

it prints 01-01-70 can any1 tell me where is the error?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/228795-date-conversion-from-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.