• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

dateformat not working after server upgrade

New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

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.

TOPICS
Database access

Views

526

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

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

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

Have you verified that #News_Date# is what you expect it to be?
You could wrap the offending line of code in a CFTRY and email yourself the full error so you don't have to wait on the host.

<cftry>
    #dateFormat(News_Date,'dddd mmmm dd, yyyy')#
<cfcatch type="any">
    <cfmail to="me@sample.com" from="myserver@sample.com" subject="Error MEssage" typ="html">
    <cfdump var="#News_Date#">
    <cfdump var="#cfcatch#">
</cfmail>
</cfcatch>
</cftry>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

The site has been perfectly stable for more than 10 years with that code on multiple pages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

CF10

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

Yes, it's a server change.

 

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

Well, you're not using a capital D as in the article.  Have you tried using a different mask?  Verified the #News_Date#?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

Are you suggesting this:

 

#dateformat(News_Date, 'DDDD mmmm DD, yyyy')#

How many capital D's?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

Wasn't suggesting that, no.  Just pointing out the tech note seemed to talk about using capital D whereas you were not using that.
What I was suggesting is that you try a different mask just to see if it works.  And, still no word on verifying the #news_date#.  It's possible you may have a malformed date in your data?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

No, it's not possible.  The site has a very active calendar that has been in operation for more than 10 years.  The change happened as soon as they moved the site to a new server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

did you apply the update in the link i provided?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2023 Aug 21, 2023

Copy link to clipboard

Copied

It's not my server, I sent them the info.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 26, 2023 Aug 26, 2023

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 26, 2023 Aug 26, 2023

Copy link to clipboard

Copied

 

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2023 Aug 27, 2023

Copy link to clipboard

Copied

@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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 27, 2023 Aug 27, 2023

Copy link to clipboard

Copied

Absolutely, here you go. (I do think the host would know what version they
are running)

My ColdFusion version: 10,0,23,302580

--
Monte
monte@saagervision.com
“what we have here is… failure to communicate”

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2023 Aug 28, 2023

Copy link to clipboard

Copied

@Monte28993316xw9z , did you do the validation test I suggested?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 28, 2023 Aug 28, 2023

Copy link to clipboard

Copied

Yes. V10...

--
Monte
monte@saagervision.com
“what we have here is… failure to communicate”

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 28, 2023 Aug 28, 2023

Copy link to clipboard

Copied

I, too, asked about the possibility of an invalid date coming through and, instead of validating, you simply said it was impossible because nothing had changed (famous last words).  @BKBK is now also asking you to validate the dates and I don't see that you've done that?  Why not?  Even if you think it's impossible, humor us.  Otherwise, it's "impossible" to eliminate that as the potential issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 28, 2023 Aug 28, 2023

Copy link to clipboard

Copied

The site has been moved to a new server group that has their server set
correctly.

The issue was the server implementation, not anything to do with the actual
data.

However, as I was starting the move they did patch their server and the
dates were showing correctly so there REALLY WAS NO DATA ISSUE.

--
Monte
monte@saagervision.com
“what we have here is… failure to communicate”

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2023 Aug 28, 2023

Copy link to clipboard

Copied

It sure would be nice to know exactly what was different with the server implementation.

 

Dave Watts, Eidolon LLC 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation