Display specific date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Display specific date

Post by vchris »

How would I display a specific date depending on the query string?

My query string will have "month" and "year" variables.
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Post by ryanlwh »

do you mean a query to get the records for a specific date? or format the output?
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Post by vchris »

That's right a query to get the records from the month of September 2005 for example.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

date('Y-m-d',mktime(12,0,0,9,1,2005,0));
:?
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Re: Display specific date

Post 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']));
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

vchris wrote: No mysql included only php.
Why not???
Post Reply