Page 1 of 1

Display specific date

Posted: Tue Sep 20, 2005 7:08 pm
by vchris
How would I display a specific date depending on the query string?

My query string will have "month" and "year" variables.

Posted: Tue Sep 20, 2005 7:16 pm
by ryanlwh
do you mean a query to get the records for a specific date? or format the output?

Posted: Tue Sep 20, 2005 7:25 pm
by vchris
That's right a query to get the records from the month of September 2005 for example.

Posted: Tue Sep 20, 2005 7:33 pm
by feyd

Code: Select all

SELECT * FROM `table` WHERE EXTRACT(MONTH FROM `dateField`) = '09' AND EXTRACT(YEAR FROM `dateField`) = '2005'
or YEAR_MONTH....

http://dev.mysql.com/doc/mysql/en/date- ... tions.html

Posted: Tue Sep 20, 2005 8:05 pm
by vchris
that's good but how could I simply do an echo of the month and year depending on the query string. No mysql included only php.

Posted: Tue Sep 20, 2005 8:32 pm
by feyd

Code: Select all

date('Y-m-d',mktime(12,0,0,9,1,2005,0));
:?

Re: Display specific date

Posted: Wed Sep 21, 2005 12:11 am
by ryanlwh
vchris wrote:How would I display a specific date depending on the query string?

My query string will have "month" and "year" variables.
I reread and reread and I finally got what you mean... you want to format the dates gotten out of the query...

Code: Select all

date('Y-m-d',strtotime($record['date']));

Posted: Wed Sep 21, 2005 12:17 am
by hawleyjr
vchris wrote: No mysql included only php.
Why not???