Date Format in Query

2006-08-24 Thread c_doug
I am trying to make a Archives (by month) section in a blog. How can I format a date for use in a query? Example so far: $cmonth = date_format(Post.created, 'F'); $data = $Post-query('SELECT DISTINCT `' .$cmonth. '` FROM posts'); I was trying to Select Distinct by Month but this only outputs

Re: Date Format in Query

2006-08-24 Thread Samuel DeVore
you should look at the documentation for the database you are using. in mysql one might do distinct month(Post.created) but reading some documentation would really save yourself some ridicule in the long run. If you rely on this list as your crutch people are going to start getting

Re: Date Format in Query

2006-08-24 Thread c_doug
Ridicule? Sorry, I have found it difficult to find info on things that are simple to accomplish in other languages. I am sure that is understandable. As far as I know there is not even a book on CakePHP at this time. I primarily work in Usability/UI Design. As far as server-side I have

Re: Date Format in Query

2006-08-24 Thread c_doug
I am sure everyone here knows this but here is a good link on the topic: I've seen too many applications performing date calculations at the code level when the same can be done using built-in MySQL functions. http://www.databasejournal.com/features/mysql/article.php/2172731

Re: Re: Date Format in Query

2006-08-24 Thread Samuel DeVore
sorry c_doug, I was trying to be a little lite and facetious and it failed, I was really trying to point out that your issue was one of mysql vocabulary and db 'stuff' and not really related to Cake per say, not that this is not a place to ask those kinds of questions but also to perhaps guide

Re: Re: Date Format in Query

2006-08-24 Thread Larry E. Masters aka PhpNut
Agreed you are the Old Fart-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @accesspublic*/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group.

Re: Date Format in Query

2006-08-24 Thread c_doug
Actually that is a pretty funny quote. I am thinking of putting a sign in our room that says Save yourself some ridicule for everyone who comes in with questions or requests. I'ts kind of like the angry IT guy on SNL. --~--~-~--~~~---~--~~ You received this