Results 1 to 10 of 10

Thread: coldfusion date insert problem(resolved)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    asia
    Posts
    87

    Question coldfusion date insert problem(resolved)

    how do i code some coldfusion insert data that can recieve date value:

    eg:

    <cfquery name="insdata" datasource="blabla">
    insert into table1(name,dob)
    values ('#form.namefield#','#form.dobfield#')
    </cfquery>

    this query give me error page....
    so how do i code it? the right way?
    please! please!
    Last edited by ZUWARI; Oct 31st, 2002 at 03:14 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Code:
    
    <cfquery name="insdata" datasource="blabla">
    insert into table1(name,dob)
    values ('#form.namefield#','#DateFormat(form.dobfield,"dd mm yyyy")#
    ')
    </cfquery>

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    asia
    Posts
    87

    Red face hmm.....

    yes , no error page but the result is that when i call it back from database, the format is wrong..

    eg: input in input box - 20 3 02 (dd m yy)

    output using cfoutput - <cfoutput query="result">#date format(doe, "dd m yy")#</cfoutput> -----> resulted= 02 3 20 (yy m dd)

    i don know what happend here....

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    asia
    Posts
    87

    oppss

    ignore the 'date format' .....typing error..it should be ....dateformat(doe, "d m yy")

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Solved?

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    asia
    Posts
    87

    not solved yet!

    nop...

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    OK, from what I understand, you're not getting it back in the proper format.

    What format are you getting it as, and what format do you want?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    asia
    Posts
    87
    i get yy mm dd format

    i want ---> dd mm yy format.

    even when i code the output this way....

    <cfoutput query="viewdata">#dateformat(dob, "dd mm yy")#</cfoutput>

    i still don get it right

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    asia
    Posts
    87

    solved

    thanks medhak!

    i find another way around. i will only use character/string this time for the doe field. and create some javascript to validate date value.



  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Well... OK.

Posting Permissions

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



Click Here to Expand Forum to Full Width