4 Replies Latest reply on Jan 25, 2008 9:27 AM by (lozzer)

    date format

    Level 1
      Hi,
      I am pulling the date from a database with this:

      SELECT id, story_short, story_full, image1_name, DATE_FORMAT(`date`, '%D %b
      %Y') AS formatted_date
      FROM news_stories
      ORDER BY `date` DESC

      This selects the date:
      7th August 2007

      The client just wants it:

      August 2007

      SELECT id, story_short, story_full, image1_name, DATE_FORMAT(`date`, ' %b
      %Y') AS formatted_date
      FROM news_stories
      ORDER BY `date` DESC

      This works but is it the best way?

      Thanks
        • 1. Re: date format
          Günter Schenk Level 4
          Hi lozzer,

          %b will return an abbreviated month name (Jan), whereas %M will return it in full glory (January)

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: date format
            Level 1
            Hi Gunter<br />I explained it badly :-)<br />The client wants to do away with the day and wants<br />August 2007 rather than 27th August 2007<br />Thanks<br /><br />lozzer<br /><Günter_Schenk@adobeforums.com> wrote in message <br />news:3c05ebc8.0@webcrossing.la2eafNXanI...<br />> Hi lozzer,<br />><br />> %b will return an abbreviated month name (Jan), whereas %M will return it <br />> in full glory (January)<br />><br />> Cheers,<br />> Günter Schenk<br />> Adobe Community Expert, Dreamweaver
            • 3. Re: date format
              Günter Schenk Level 4
              DATE_FORMAT(`date`, '%M %Y') AS formatted_date

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: date format
                Level 1
                Thanks Gunter :-)<br /><Günter_Schenk@adobeforums.com> wrote in message <br />news:3c05ebc8.2@webcrossing.la2eafNXanI...<br />> DATE_FORMAT(`date`, '%M %Y') AS formatted_date<br />><br />> Cheers,<br />> Günter Schenk<br />> Adobe Community Expert, Dreamweaver