Skip to main content
Participating Frequently
August 21, 2023
Question

dateformat not working after server upgrade

  • August 21, 2023
  • 3 replies
  • 2642 views

They dropped a servder upgrade on me and now (after a little more than 10 years) this code doesn't work.  Any ideas what I can change it to?

 

#dateformat(News_Date, 'dddd mmmm dd, yyyy')#

 

HELP!  Please,

 

And thank you.

This topic has been closed for replies.

3 replies

BKBK
Community Expert
Community Expert
August 26, 2023
quote

They dropped a servder upgrade on me and now (after a little more than 10 years) this code doesn't work.  Any ideas what I can change it to?

#dateformat(News_Date, 'dddd mmmm dd, yyyy')#

 

By @Monte28993316xw9z

 

Yes, here is an idea. Locate the line of code that contains 

 

dateformat(News_Date, 'dddd mmmm dd, yyyy')

 

Add the following validation code just before that line:

 

<cfset newsDateAsString=toString(News_Date)>
<cfif isDate(News_Date)>
	<cfset News_Date=parseDateTime(newsDateAsString)>
<cfelse>
	<cflog file="News_Date_Check" text="The value of the 'News_Date' variable is currently '#newsDateAsString#', which does not represent a valid date. Location: #getTemplatePath()#" type="error">	
	Sorry, error. The error has been logged. We're working on it.
	<cfabort>
</cfif>

 

If there is a wrong value for date, an error will be logged in News_Date_Check.log

 

Inspiring
August 26, 2023

 

they changed the way the DD or dd is ready its day in the year ( vs what it was i believe). he needs to patch the server or come up with another way to code that output not using CF. Everything is in the link I posted.

BKBK
Community Expert
Community Expert
August 27, 2023

@rickmaz , "dd" was used, instead of "DD", as @sdsinc_pmascari said. So I wonder whether patching the server is relevant. In any case, @Monte28993316xw9z mentioned being on CF10. 

 

@Monte28993316xw9z , are you really on CF10? Run the following as a test CFM page. What does it give you?

My ColdFusion version: <cfoutput>#server.coldfusion.productversion#</cfoutput>
Inspiring
August 21, 2023
Participating Frequently
August 21, 2023

So this is a server fix rather than a code change?

Community Expert
August 21, 2023

Yes, it's a server change.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC
Legend
August 21, 2023

What version of ColdFusion are you now running?  What is the exact error you are getting?
I just ran this on CFFiddle and it runs fine.

<cfset News_Date = now()>
<cfoutput>
#dateformat(News_Date, 'dddd mmmm dd, yyyy')#    
</cfoutput>
Participating Frequently
August 21, 2023

They offer fabulous error reporting...

The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.

You can see it in action here:
Northwest Association of Slot Track Enthusiasts : Results (naste.org)

I'm awaiting info on what version they are running.
Thank you very much.

Participating Frequently
August 21, 2023

A page will load without error with that line commented out:

http://www.naste.org/index.cfm