Hi!
I'm making articles section using php/mysql; so I've got a problem in displaying dates;
In some of the articles I don't have complete date, like in date(DATE type 0000-00-00) field there is only a year or year and month; some of them are complete(year-month-day).
I'm using following query to format dates:
$sql = "select headline, body, sid, date_format(date, '%M %e, %Y') as fdate from articles order by date desc";
So dates look like this(in case if date is complete year-month-day):
EX: October 3, 2002
But if date is not complete (month-year) script returns:
EX: October 0, 2002
In case when there is only a year in date field (2002-00-00) it shows no date at all.
I just want script to return complete date when it's available, when there is only -month and year- in date field I want it to return date in following format, EX: October, 2002 instead of October 0, 2002...In case if there is only a year in Date field EX: 2002; I want script to show year, instead of empty space.
I've tryed a few methods, in all cases if I managed to format date (month day, year) or (month, year), I'm still getting empty space instead of year.
Any ideas?
Thanks