Skip to main content
Inspiring
December 6, 2012
Question

Checks the complete date (mm/dd/yyyy) against another compelete date (mm/dd/yyyy)

  • December 6, 2012
  • 2 replies
  • 711 views

Hi,

Is there a cold fusion function that checks the complete date (mm/dd/yyyy) against another compelete date (mm/dd/yyyy)?

I have used the DateCompare but it only checks the month, day or year depending on the precision being used.

Thanks,

Mike

    This topic has been closed for replies.

    2 replies

    Inspiring
    December 6, 2012

    I think you might need to read the docs a bit more closely.  From the docs for dateCompare():

    datePart

    Optional. String. Precision of the comparison.

    • s Precise to the second (default)
    • n Precise to the minute
    • h Precise to the hour
    • d Precise to the day
    • m Precise to the month
    • yyyy Precise to the year

    Indeed, even by default its behaviour is not what you suggest it is.

    --

    Adam

    Inspiring
    December 6, 2012

    What kind of check are you talking about?

    userCold9Author
    Inspiring
    December 6, 2012

    Check the complete date form a form against a complete date from a database table.

    I would be check the date from the form against all the dates in the database table.

    There would be two form dates, a start and end date. In the database there would be a start and end date.

    The date check would ensure the entered start and end dates on the form do not overlap any of the start and end dates in the database.

    I did notice the datecompare can be used without the precision option.

    Mike

    Inspiring
    December 6, 2012

    Looks like you are trying to use coldfusion code when sql code would be more appropriate.

    If I am interpreting your post correctly, you want to do somethign like this:

    select some fields

    from some tables

    where #coldfusion start date# not between database_start_date and database_end_date

    and more stuff to complete your logic