Hi All,
After migration from AX-2012, we came across a situation in which there was a customization in standard date EDT in the format 03-Mar-2023. As we know that in F&O, we can't change the property of the EDT. Can anyone help me, is there any way can achieve this through code extension. Means does anyone know the class or method which does the date formatting so that we can do the extension and change the format. Or If is there any setup through which we can achieve the mentioned date format?
Regards
Neeraj
Hi Neeraj,
I wonder if the previous reply was helpful for you. It would be great if you can provide an update.
As a follow up, I did create (and share) a feature where this requirement can be setup by each user as personalization: More options to personalize the date and time format - Dynamics 365 Finance and Operations - Dynamicspedia
Hi Neeraj,
You can't change the date properties of an EDT, also not with an extension. A cumbersome action would be creating your own EDT and make table and form extensions. As you need it for any form, this would be too much of a hassle. I checked for a more generic and easy way to achieve it. You can use the below coding which will change the DateMonth property on runtime. Note that it will consume some additional loading time (milliseconds) when opening forms. In my experience, it isn't a bad experience. I opened the sales order details and released product details without a major impact on performance.
You might enhance the example for DateTime controls. You can also extend it to get the preference with a new setting on the user options.
////// Extension class subscribing to FormRun delegates. /// static public final class DynamicspediaFormRun_Extension { ////// Handles date formatting during the initialization of the forms. /// [SubscribesTo(classStr(FormRun), staticDelegateStr(FormRun, onFormRun))] public static void onFormRunDateFormat(FormRun _formInstance) { FormControl formControl; FormDateControl formDateControl; List controlList = new List(Types::AnyType); controlList = _formInstance.controlList(); ListIterator li = new ListIterator(controlList); while (li.more()) { formControl = li.value(); if (formControl is FormDateControl) { formDateControl = formControl; formDateControl.dateMonth(DateMonth::Short); } li.next(); } } }
Hi Mohit,
It didn't change my format to 03-Mar-2023. Rather it changed to 03-03-2023, which is not our requirement.
Regards
Neeraj
Hi, Check this thread
community.dynamics.com/.../how-can-i-change-format-all-datetime-to-dd-mm-yy
Hi Martin,
I need this for all the forms. Means for full F&O application. I was thinking, there will be some class or method which would be doing the formatting. If you know any class or method which does this, please let me know. Or else if this can be achieved through the setup, then it will be great.
Where do you want to change the format? For example, in a single form?
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156