Page 1 of 1

Convert date to strftime!?

Posted: Mon Mar 31, 2008 10:27 am
by jmansa
I am having som trouble converting my date from "23-06-08" to "Monday the 23 of march 2008". Can anybody help...

My current code looks like this:

Code: Select all

$result = mysql_query("SELECT event_match, DATE_FORMAT(event_date_start, '%d-%m-%y') AS date, event_course, event_time, event_category, event_electric FROM oak_module_calendar_events ORDER BY event_date_start") 
or die(mysql_error());  
 
while($row = mysql_fetch_array( $result )) {
 
$date = $_GET['event_date_start'];
 
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15%">';
        echo $row['date'];
        echo '</td><td align="left" width="25%">';
        echo $row['event_match'];
        echo '</td><td width="40%">';
        echo $row['event_course'];
        echo '</td><td width="10%" align="center">';
        echo $row['event_time'];
        echo '</td><td width="5%" align="center">';
        echo $row['event_category'];
        echo '</td><td width="5%" align="center">';
        if ($row['event_electric'] == "yes") {
        echo 'Ja';
        } else {
        echo 'Nej';}
        echo '</td>
      </tr>
    </table>';
}
Thanks alot...

Re: Convert date to strftime!?

Posted: Mon Mar 31, 2008 10:35 am
by aceconcepts
What format is used to store you date in the database - what data type?

Re: Convert date to strftime!?

Posted: Mon Mar 31, 2008 10:41 am
by jmansa
The format in DB is:
2008-04-06 00:00:00

Re: Convert date to strftime!?

Posted: Mon Mar 31, 2008 11:21 am
by aceconcepts
I mean't what data type do you use for you date field - is it DATE or VARCHAR...?

Re: Convert date to strftime!?

Posted: Mon Mar 31, 2008 11:32 am
by jmansa
Ups...sorry... DateTime