Skip to main content
Participating Frequently
July 31, 2008
Question

How do I work with dates from URL and POST?

  • July 31, 2008
  • 2 replies
  • 267 views
When I pass the same date from an <A> tag and a form <input> tag, the results are different.
They look the same, but the URL variable isn't in the same format when you use the result in a calculation.

See http://www.fishingguidenow.com/datetest.cfm

Please help me find a way to consistently calculate the results whether they come from a form or a URL.
    This topic has been closed for replies.

    2 replies

    Inspiring
    July 31, 2008
    A second point to realize is that any data you get from a form, either
    with get or post, is string data - *NOT* a date object. It may look
    like a date to us humans. Many of ColdFusion's functions will do their
    best to convert the string into a date.

    But you are leaving a lot to chance if you are not converting specific
    strings to specific dates. Just remember that "2/10/08" is February
    tenth 2008 to some, the second of October 2008 to others and maybe
    February tenth or October second, 1908 to a few archaic types.



    Inspiring
    July 31, 2008
    RichieWhite wrote:
    > When I pass the same date from an <A> tag and a form <input> tag, the results
    > are different.
    > They look the same, but the URL variable isn't in the same format when you use
    > the result in a calculation.
    >
    > See http://www.fishingguidenow.com/datetest.cfm
    >
    > Please help me find a way to consistently calculate the results whether they
    > come from a form or a URL.
    >

    I don't see a problem with the date values you are receiving from the
    post and get data.

    I note that you are adding one *month* to the received date to get
    'tomorrow'. That seems to be a bit more then tomorrow to me, but
    otherwise it is working as coded.

    The url example is missing <cfoutput> tags so the output is not rendered
    for the value of the function, but I presume it will work the same as
    the form test.