I put one select on each question.

"wizard007" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
>
> I have just started with MYSQL and am building a racing site using PHP.
>
> I have Date, Course, Time, Horse, Odds, Result as my fields and the 
> database
> is poulated with the data.
>
> I'm having problems with the formatting of data when it is output.
>
> Problem 1.
> I want to display the date in the format dd/mm/yyyy. I know you can use 
> the
> DATE_FORMAT command but I can't seem to get it to work. Can anyone give me
> the exact script I need to write.
***
select date_format(Date,"%d/%m/%Y") as Date from table;
***
>
> Problem 2.
> I also want to display the results in the last 7 days in descending order 
> by
> date.
***
select date_format(Date,"%d/%m/%Y") as Date from table where
datediff(date_format(now(),\"%Y-%m-%d 
%H:%i:%s\"),date_format(Date,\"%Y-%m-%d %H:%i:%s\"))<=7
order by Date desc;
***
> I can't seem to work out a way of doing that either.
>
> I'm a newb so please be gentle!!!!! :-)
>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Date-Problems-tf1937078.html#a5307385
> Sent from the MySQL - General forum at Nabble.com.
> 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to