Skip to main content
Inspiring
November 15, 2006
Question

CFSELECT and queries

  • November 15, 2006
  • 3 replies
  • 452 views
I am trying to pull some dates out of my database, and have them show up in
a <cfselect> that users than then pick.

I have:

<cfselect name="ClassDate" size="1" required="yes" message="Please select
the date the class began." query="RequestDate" value="class_date"
display="class_date">

But my problem is on the date formatting. Its a MySql date field, and so it
shows the whole 'ts date time' etc.

How can I do this so all I show in the <cfselect> is the date, formatted
like 03/05/2006, etc?

Thanks!
Steve


    This topic has been closed for replies.

    3 replies

    Inspiring
    November 16, 2006
    Rick was right:

    Select *, DATE_FORMAT(date, '%m/%d/%Y) AS date, ........... It should work.

    -a
    Inspiring
    November 16, 2006
    Well my format is a little off from what you want but just look up
    date_format on mysql web site and you will get it.

    "Rick" <rick@di-wave.com> wrote in message
    news:ejg9am$t6s$1@forums.macromedia.com...
    > Try something like this in your query.
    >
    > SELECT *, date_format(SchDate, '%W, %b %D, %Y') as sdate
    >
    >
    > "Steve Grosz" <boise_bound@hotmail.com> wrote in message
    > news:ejg92i$t0h$1@forums.macromedia.com...
    >>I am trying to pull some dates out of my database, and have them show up
    >>in a <cfselect> that users than then pick.
    >>
    >> I have:
    >>
    >> <cfselect name="ClassDate" size="1" required="yes" message="Please select
    >> the date the class began." query="RequestDate" value="class_date"
    >> display="class_date">
    >>
    >> But my problem is on the date formatting. Its a MySql date field, and so
    >> it shows the whole 'ts date time' etc.
    >>
    >> How can I do this so all I show in the <cfselect> is the date, formatted
    >> like 03/05/2006, etc?
    >>
    >> Thanks!
    >> Steve
    >>
    >
    >


    Inspiring
    November 15, 2006
    Try something like this in your query.

    SELECT *, date_format(SchDate, '%W, %b %D, %Y') as sdate


    "Steve Grosz" <boise_bound@hotmail.com> wrote in message
    news:ejg92i$t0h$1@forums.macromedia.com...
    >I am trying to pull some dates out of my database, and have them show up in
    >a <cfselect> that users than then pick.
    >
    > I have:
    >
    > <cfselect name="ClassDate" size="1" required="yes" message="Please select
    > the date the class began." query="RequestDate" value="class_date"
    > display="class_date">
    >
    > But my problem is on the date formatting. Its a MySql date field, and so
    > it shows the whole 'ts date time' etc.
    >
    > How can I do this so all I show in the <cfselect> is the date, formatted
    > like 03/05/2006, etc?
    >
    > Thanks!
    > Steve
    >