Date format - help
Posted: Sun Jun 12, 2005 5:55 am
Hi,
I am into some problem with the date format of mysql. The following code lists all my dates currently stored in "date" column in table - test.
The format it shows my dates is -
But I want the date to be displayed in the following format:
I also want to retrieve just the distinct year from the date column.
Which functions should i consult to get these things done? I tried this for the first thing:
No luck.
Could you help?
I am into some problem with the date format of mysql. The following code lists all my dates currently stored in "date" column in table - test.
Code: Select all
<?php
require_once('DbConnector.php');
//creating a database connector object
$connector = new DbConnector();
$sql='select date from test order by date desc';
$result=$connector->query($sql);
while ($row = $connector->fetchArray($result)) {
echo $row[date].'<br>';
}
?>Code: Select all
2005-12-19
2005-07-13
2005-06-30
2005-06-12
2005-06-07
2005-04-05
2005-02-17
2005-02-15
2004-06-10
2003-06-20Code: Select all
Month Name in full (space) date,(space) Year in 4 digit
(example - October 9, 2004 )Which functions should i consult to get these things done? I tried this for the first thing:
Code: Select all
<?php
require_once('DbConnector.php');
//creating a database connector object
$connector = new DbConnector();
$sql='select date from test order by date desc';
$result=$connector->query($sql);
while ($row = $connector->fetchArray($result)) {
echo $row[date].'<br>';
echo date($row[date],'F d,Y').'<br>';
}
?>Could you help?