Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default MySQL Dates

    Hello,
    I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are
    "yyyy-mm-dd" format. However, we want date entering formats in the form
    (<cfform>Dates</cfform>) of "mm/dd/yyyy".
    So, in this case, how can I make this searchable on dates in different format.
    1. Is there a way to change Date format in MySQL? If possible to change MySQL
    date types to "mm/dd/yyyy"
    2. I could change date types (from the form) to "yyyy-mm-dd" format before it
    is submitted to Database to search on actual dates.
    How can I change date FORM format from "mm/dd/yyyy" to MySQL format
    "yyyy-mm-dd"?
    Point is dates in the front end userinterface must be entered "mm/dd/yyyy"
    form before it goes to search dates on dates on MySQL .

    Thanks:D

    cf101 Guest

  2. Similar Questions and Discussions

    1. How to you compare dates in a query in Mysql
      Dear friends, Plesae help in finding the correct syntax for comparing two dates in a query in MySql database Thank you Subodh Gupta
    2. Searching on Dates in MySQL
      Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats...
    3. Web form dates to MySQL
      I am building a admin form (PHP/MySQL), so staff can input Job Vacancy descriptions into the Website via a Web form that can be displayed on the...
    4. Array of Dates from MYSQL?...
      This has been puzzelling me for a couple of weeks now, and just can't figure it out. Does anyone know how to return an array of dates from MySQL...
    5. Selecting a range of dates in MySql
      I need to do a search in MySql for birth date range. (i.e. for birth date Any suggestions on how to do this select? Thanks!
  3. #2

    Default Re: MySQL Dates

    #DateFormat(todayDate, "mmm-dd-yyyy")#
    #DateFormat(todayDate, "mmmm d, yyyy")#
    #DateFormat(todayDate, "mm/dd/yyyy")#

    jorgepino Guest

  4. #3

    Default Re: MySQL Dates

    When inserting the date into your DB, use CREATEODBCDATE and it won't matter
    what format the date is in.

    EX.
    INSERT INTO yourTable (date_field)
    VALUES (#CREATEODBCDATE(form.date_variable)#)

    This will adjust the date accordingly to be inserted in MySQL and will be
    searchable no matter what format you use in a SELECT statement.

    Tulsa Guest

  5. #4

    Default Re: MySQL Dates

    Could something like this work...
    <cfset date = '01/31/2000'>
    <cfoutput>
    dd/mm/yyyy #date# <BR>
    <cfset newdate = "#ListGetAt(date, 3 , '/')#-#ListGetAt(date, 1 ,
    '/')#-#ListGetAt(date, 2 , '/')#" >
    yyyy-mm-dd :
    #newdate#
    </cfoutput>:confused;

    jorgepino Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139