Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > date format help request
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 19th November 05:41
moose
External User
 
Posts: 1
Default date format help request



I have a .PhP web page that gets its results from a query like
$result = mysql_query("SELECT * FROM myTable Order by DueDate",$db);

The result includes a field with a date, which gets returned as
"2008-05-25".

What would be required to have the query return a date with the format
like "05.25.2008".

I have to figure this has to have a simple solution, but I don't know
whether to start with the MySQL database settings or by using PhP.

Thanks,
  Reply With Quote


 


2 19th November 05:41
rbenson
External User
 
Posts: 1
Default date format help request



http://dev.mysql.com/doc/refman/5.1/...on_date-format

$result = mysql_query("SELECT field1, field2,
DATE_FORMAT('DueDate','%c.%e.%Y') FROM myTable Order by DueDate",$db);
  Reply With Quote
3 19th November 05:41
fwdkhan
External User
 
Posts: 1
Default date format help request


Hi Moose,


You can use the date() and strtotime() function to convert your
result;

You can try like this:
echo date( "m-d-Y", strtotime("2008-05-25") );


OUTPUT:
05-25-2008


Regards,

Fahad Khan
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666