order by date (verity)

Discussion in 'Programming' started by pommoz, Nov 19, 2007.

  1. #1
    Hi
    My first post :D, here goes:

    I have a verity index that brings back custom1 as the document date (modified) in cfMX 6.1. First the page does a cf search on the collection then creates a sql result of the collection so the results can be ordered by date.

    <cfset rowsPerPage = #Form.MaxRows#>
    <cfparam name="FORM.startRow" default="1">
    <CFSEARCH name = "GetResults"
    collection = "research"
    criteria = "CF_KEY <contains> #FORM.Criteria# <or> TITLE <contains> #FORM.Criteria#">

    <cfoutput query="GetResults">

    <cfset temp = querySetCell(GetResults, "custom1", #CreateODBCDate(custom1)#, #GetResults.currentrow#)>

    <cfquery dbtype="query" name="GetResults">
    SELECT *
    FROM GetResults ORDER BY custom1 desc
    </cfquery>


    I had this code working perfectly previously and now the date conversion does not seem to want to play, would you suggest I use a number of mid(), rights() etc to get the date/time out of the returns from the collection? Below the list of dates:

    Fri Sep 05 07:07:06 2003
    Wed Jan 11 04:23:36 2006
    Thu Aug 11 03:28:44 2005
    Mon Aug 15 03:47:02 2005
    Tue Apr 12 06:38:30 2005
    Wed Feb 09 23:26:32 2005
    Fri Dec 10 02:41:34 2004
    Fri Aug 27 01:35:22 2004
    Wed Jan 21 23:46:50 2004
    Thu Sep 04 04:23:30 2003
    Thu Sep 04 04:21:22 2003
    Thu Sep 04 04:22:04 2003
    Thu Sep 04 04:21:38 2003
    Thu Sep 04 04:22:32 2003
    Thu Sep 04 04:23:08 2003
    Thu Sep 04 04:22:50 2003
    Thu Sep 04 04:20:48 2003
    Wed Sep 17 06:43:44 2003
    Wed Sep 17 06:32:40 2003

    with this list the first date is converted correctly with CreateODBCDate() then following error generated

    Fri Sep 05 07:07:06 2003
    {d '2000-09-05'}
    Wed Jan 11 04:23:36 2006

    The value "Wed Jan 11 04" could not be converted to a date.


    Any help would be much appreciated.

    Thanks
    Mark
     
    pommoz, Nov 19, 2007 IP
  2. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't think the first value is converted correctly either.

    Afaik CF date functions can parse most standard java date formats (short, medium, long). But what format is "Fri Sep 05 07:07:06 2003". Any way you could change it? Then you could just use CAST(...) in your QoQ.
     
    cfStarlight, Nov 19, 2007 IP