Jump to content

[SOLVED] strings


chocopi

Recommended Posts

you can either

<?php
$sql = "SELECT DATE_FORMAT(datecol, '%d %M %Y') as date FROM mytable";
$res = mysql_query($sql) or die (mysql_error()."<p>$sql</p>");
while ($row = mysql_fetch_assoc($res))
{
    echo $row['date'], '<br>';
} 
?>

 

or, formatting the date with php

<?php 
$sql = "SELECT datecol FROM mytable";
$res = mysql_query($sql) or die (mysql_error()."<p>$sql</p>");
while ($row = mysql_fetch_assoc($res))
{
    echo date('d F Y', strtotime($row['datecol'])), '<br>';
} 

?>

Link to comment
https://forums.phpfreaks.com/topic/52248-solved-strings/#findComment-257781
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.