Jump to content

[SOLVED] Time Format!!


iceman023

Recommended Posts

I can't believe its taking me this long to figure out how to go from

 

2009-05-04 00:00:00

 

to 05/04/09

 

I have all the dates that a photo was upload to the database in a field called date. I just want to change the display of the format from the database.

Some please help!

 

Pic of the database attached

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/157564-solved-time-format/
Share on other sites

Or is it this one

 


$numresults = mysql_query("
SELECT * FROM Photos 
WHERE Published = 'no' 
AND DATE_FORMAT(`Date`, '%m/%d/%y') AS `Date` FROM Photos
ORDER BY ID DESC"); // the query.
$numrows = mysql_num_rows($numresults); // Number of rows returned from above query.
if ($numrows == 0){
echo("No results found matching your query - $query"); // bah, modify the "Not Found" error for your needs.
exit();}

Link to comment
https://forums.phpfreaks.com/topic/157564-solved-time-format/#findComment-831122
Share on other sites

Sorry kinda new to this..

 


$numresults = mysql_query("
SELECT DATE_FORMAT(`Date`, '%m/%d/%y') AS `Date`,
* FROM Photos	
WHERE Published = 'no' 
ORDER BY ID DESC"); // the query.
$numrows = mysql_num_rows($numresults); // Number of rows returned from above query.
if ($numrows == 0){
echo("No results found matching your query - $query"); 
exit();}

Link to comment
https://forums.phpfreaks.com/topic/157564-solved-time-format/#findComment-831128
Share on other sites

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in....

 

 

 

 

in php MyAdmin sql it say....

 

 

Error

SQL query: 

 

SELECT DATE_FORMAT( `Date` , '%m/%d/%y' ) AS `Date`

FROM Photos, *

FROM Photos

WHERE Published = 'no'

ORDER BY ID DESC

LIMIT 0 , 30

 

MySQL said: 

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM Photos   

WHERE Published = 'no'

ORDER BY ID DESC

LIMIT 0, 30' at line 2

Link to comment
https://forums.phpfreaks.com/topic/157564-solved-time-format/#findComment-831138
Share on other sites

Sorry this one...

 

 

Error

SQL query: 

 

SELECT DATE_FORMAT( `Date` , '%m/%d/%y' ) AS `Date` ,

* FROM Photos

WHERE Published = 'no'

ORDER BY ID DESC

LIMIT 0 , 30

 

MySQL said: 

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM Photos   

WHERE Published = 'no'

ORDER BY ID DESC

LIMIT 0, 30' at line 2

Link to comment
https://forums.phpfreaks.com/topic/157564-solved-time-format/#findComment-831141
Share on other sites

I hate to be a pain in the ass but

 

I have this

 

SELECT * , DATE_FORMAT( `Date` , '%m %d %y' ) AS `Date` 
FROM Photos
WHERE Published = 'no'
ORDER BY ID DESC 
LIMIT 0 , 30 

 

and the output is "2009-05-04"

shouldnt it be.... "05.04.09"

 

IF not how do i get "05.04.09"

 

Link to comment
https://forums.phpfreaks.com/topic/157564-solved-time-format/#findComment-831155
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.