Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

When do you get an incorrect date in coldfusion?


Asked by Logan Acevedo on Dec 01, 2021 FAQ



If the text contains only numbers (such 1932), and is not surrounded by quotation marks, ColdFusion interprets it as a date/time object, resulting in an incorrect value. Note: In the DateDiff function, there is a difference in how the date difference is calculated for the member function.
Consequently,
Unfortunately, there are some database quirks concerning inputting and outputting data in this format that can cause problems. Although your database may store the date as a short date of date/time type, the output of a ColdFusion query will often result in the date being in the DateTime format of 2001-02-18 00:00:00.
Keeping this in consideration, Note that ColdFusion allows the year to be either 2001 or 01. REQUIRED="yes" will ensure the user inputs data in the text box. If no data is submitted, the warning message will display. The only problem with validating time is that ColdFusion uses a 24 hour clock, instead of AM and PM.
Thereof,
ColdFusion 10: Added this function. Required. A date/time object, in the range 100 AD-9999 AD. Optional. Characters that show how ColdFusion displays a date: d: Day of the month as digits; no leading zero for single-digit days.
Subsequently,
ColdFusion (2016 release) Update 3: SimpleDateFormat 's mask a is no longer followed. Use the masks t and tt to return the character string A/P or AM/PM respectively. ColdFusion 10: Added this function.