Emails going out through workflows using email templates and variables have dates in yyyy-mm-dd format. In my profile as well as system settings, the format/locale is set to mm-dd-yyyy. Dates show up correctly everywhere except for emails where Iām including date variables. Can someone please tell me how to fix this? Thanks.
Is this for all date variables?
I have tested 2 email templates where Iām sending an email to remind someone when their lease ends. The dates in both emails are like 2017-11-09. In suitecrm everywhere else, the date format is 09-11-2017 as it should be.
SuiteCRM does not honor date formats in every screen. For example, in the Schedulers screen, it uses USA formats, and always has.
I never noticed it or tested it on Emails variables, though.
It used to work just fine. Iāve sent a lot of emails through workflow using my templates. The same module variables were just fine and now the date is in the wrong format. I canāt send that out in an email because it doesnāt look proper.
(Just to correct myself: I checked the Schedulers screens and theyāre showing correct (localised) dates in 7.7.6. Whatever problem I was having before, I donāt have it anymore.)
About your problem: what format do you see written in your config_override.php file? Youāll find it in your SuiteCRM root directory.
There are also some datetime configurations in php.ini, and there is more than one php.ini (one for the CLI, one for Apache).
Config_override.php has $sugar_config[ādefault_date_formatā] = ām/d/Yā;
I mean $sugar_config[ādefault_date_formatā] = ām/d/Yā;
Cameron or anyone else have any update on this? Would really like to figure out why this is happening in my email templates and fix the date to be in mm-dd-yyyy format as it should be. Thanks.
@salman there were a few tips in my previous post that you didnāt try.
Check your php.ini 's (more than one, possibly).
sudo find / -name php.ini
There are date/time settings there, one for PHP running under the Web server, one for the CLI. Also, please repost the line from your config_override.php uising ācodeā tags so that it shows correctly here on the forums. Mine reads like this:
$sugar_config['default_date_format'] = 'd/m/Y';
$sugar_config['default_time_format'] = 'H.i';
I let this go for a while but I recently realized that itās somehow fixed. The emails I have received recently show the date in the correct mm/dd/yyyy form. I didnāt do anything.
The solution in there. I try it and my problem is solved.
This issue is still in version:
Version 7.11.15
Sugar Version 6.5.25 (Build 344)
I am new to committing amended code from github. Can someone explain how I would go ahead and patch the solution proposed by @dtosun @pgr into my system?
My workflow uses the āOnly on Saveā run Action only on Modified Records and sends an email template which has date substitutions in it. They all appear as yyyy-mm-dd even though my locale is set as dd-mm-yyy.
Stay safe, Regards, Chris.
Hi. Sorry for the delay answeringā¦
You mention my patch but I donāt think I have one, in this case - itās somebody elseās.
Some patches you can apply manually, if theyāre simple. You just type the changes from the commits into your files.
If not, then you need to run git from command line. And you need to be careful because git has a learning curve, and the potential is there for messing things up. It would be easier to provide you with instructions if there was a PR for this, but it seems there is only a patchwork of separate changesā¦