Hi,
I have a standard date picker on M3 panel.
I can get value from the field, value = 211217
Is there a way to get date format of the date picker?
Thanks
Kirill
Hi Krill,
you can try something like I have done before.
Find the Date Format for the User:currFormat = userContext['DTFM'];Then create a Function to convert based on this (something like the below):
function convToDate(strDate, currFormat) { var convertedDate; if (newFormat == "YMD8") { convertedDate = Date.parse(strDate.substring(4,6) + "/" + strDate.substring(6,8) + "/" + strDate.substring(2,4)); } if (newFormat == "YMD") { convertedDate = Date.parse(strDate.substring(2,4) + "/" + strDate.substring(4,6) + "/" + strDate.substring(0,2)); } if (newFormat == "DMY") { convertedDate = Date.parse(strDate.substring(2,4) + "/" + strDate.substring(0,2) + "/" + strDate.substring(4,6)); } if (newFormat == "MDY") { convertedDate = Date.parse(strDate.substring(0,2) + "/" + strDate.substring(2,4) + "/" + strDate.substring(4,6)); } return convertedDate; }
As I know we can only extract the values in the UI and can use MI calls to get data. In the M3 date, the format is set in multiple places like User program(MNS150) Division level(MNS100) I don't know the priority on how it works, but using the MNS150 or MNS100 API you can get the date format and Infor used to store the Date format as YDM8 format in the DataBase table.
Even the date format changes for Customer, Supplier so it's based on which screen you are using, check with your functional consultant on which program to use.
I am functional consultant
Then I believe you would have figured out the solution now
That's the way the date fields are showed on M3 Screens.
In database is always a numeric in ISO format YYYYMMDD
Thanks Rene!
You must prevent wrong date values...
That was not the question, it is up to anyone to put in their own validations where necessary!Unnecessary comment!