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

Date Formatting

New Here ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

Hi,

I have recently upgraded to CF2021.

I am having an issue with date formatting.

I have the code below.

 & #DateFormat(Now(),'YYYY')#& "_" & #DateFormat(Now(),'MM')# & "_" & #DateFormat(Now(),'DD')
the output is    2021_04_91
 
But it should be 2021_04_01
 
It appears to put a 9 instead of a 0
Would anyone might know what would be causing this?

Views

255

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

correct answers 2 Correct answers

Community Expert , Apr 01, 2021 Apr 01, 2021

It was a bug. The solution is to add the following flag

-Dcoldfusion.datemask.useDasdayofmonth=true

to your JVM settings.

 

You can do this in one of 2 ways:

  1. via the ColdFusion Administrator. Go to the page Server Settings > Java and JVM. Place the mouse cursor at the end of the contents of the input field JVM Arguments. Press the space bar once, and add the above flag. Press Submit Changes. Restart ColdFusion.
  2. via the file /cfusion/bin/jvm.config. Open the file in a text editor. Locate the set
...

Votes

Translate

Translate
Community Expert , Apr 01, 2021 Apr 01, 2021

Well, to be clear, that is only if you have applied update 1 (from last week). If not, the JVM arg will do no good unless you do also get and implement a special hotfix that was made available to solve this problem (by way of that jvm arg which it enabled and honors). For more, see my blog post from soon after CF2021 was released in November:

 

https://www.carehart.org/blog/client/index.cfm/2020/11/24/breaking_change_in_cf2021_dateformat_D_vs_d 

Votes

Translate

Translate
Community Expert ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

It was a bug. The solution is to add the following flag

-Dcoldfusion.datemask.useDasdayofmonth=true

to your JVM settings.

 

You can do this in one of 2 ways:

  1. via the ColdFusion Administrator. Go to the page Server Settings > Java and JVM. Place the mouse cursor at the end of the contents of the input field JVM Arguments. Press the space bar once, and add the above flag. Press Submit Changes. Restart ColdFusion.
  2. via the file /cfusion/bin/jvm.config. Open the file in a text editor. Locate the setting that starts with java.args=. The values are on the right-hand-side of the = symbol. Follow the list of values to the very end. Place the mouse cursor there. Press the space bar once, and add the above flag. Save the edited file. Restart ColdFusion.

 

 

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 ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

Well, to be clear, that is only if you have applied update 1 (from last week). If not, the JVM arg will do no good unless you do also get and implement a special hotfix that was made available to solve this problem (by way of that jvm arg which it enabled and honors). For more, see my blog post from soon after CF2021 was released in November:

 

https://www.carehart.org/blog/client/index.cfm/2020/11/24/breaking_change_in_cf2021_dateformat_D_vs_... 


/Charlie (troubleshooter, carehart.org)

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 ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

LATEST

Thanks for the help, Problem solved 🙂

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