View Single Post

   
  #4 (permalink)  
Old 02-28-2008, 08:13 AM
Lee Peedin
 
Posts: n/a
Default Re: Retrieve month portion of date column as 2 digits

Peter & Gordon :-)
Thanks to both of you - as you can probably tell, I'm a newbie. Your
responses were exactly what I needed.

Lee

BTW: Unless you're as old as I am, you probably won't understand the
smiley following "Peter & Gordon".
<http://www.classicbands.com/pandg.html>

On Thu, 21 Sep 2006 02:38:56 -0000, gordonb.g22xl@burditt.org (Gordon
Burditt) wrote:

>>If the value stored in the adate column is 2006-09-24, how can the
>>following statement be modified to return
>>20060924 vs. 2006924?
>>
>>SELECT concat(year(adate),month(adate),day(adate)) from demotable
>>
>>or is there a better way to retrieve a date value in the format
>>YYYYMMDD?

>
>I suggest:
>SELECT date_format(adate, '%Y%m%d') from demotable;
>
>which allows a lot more flexibility with formats.
>
> Gordon L. Burditt


Reply With Quote