Convert date to strftime!?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jmansa
Forum Commoner
Posts: 81
Joined: Wed Aug 23, 2006 4:00 am

Convert date to strftime!?

Post 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...
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Convert date to strftime!?

Post by aceconcepts »

What format is used to store you date in the database - what data type?
jmansa
Forum Commoner
Posts: 81
Joined: Wed Aug 23, 2006 4:00 am

Re: Convert date to strftime!?

Post by jmansa »

The format in DB is:
2008-04-06 00:00:00
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Convert date to strftime!?

Post by aceconcepts »

I mean't what data type do you use for you date field - is it DATE or VARCHAR...?
jmansa
Forum Commoner
Posts: 81
Joined: Wed Aug 23, 2006 4:00 am

Re: Convert date to strftime!?

Post by jmansa »

Ups...sorry... DateTime
Post Reply