Hi,
Hope you all are doing well. In Business Central, I'm receiving dates from third party application. Date's format is based upon the region/language or user. For example d/M/yyyy, d-M-yyyy, M/d/yyyy, M-d-yyyy, d.M.yyyy, M.d.yyyy etc.
After receiving date in text from 3rd part app when I try to evaluate it into type Date Business Central throws an error that '28.1.2021.' can not be evaluated into type Date, '28-1-2021' can not be evaluated into type Date etc. Let's say date I received is '28/1/2021'. System gives an error gives an error that '28/1/2021' can not be evaluated into type Date
Actually, I guess, system is accepting only 1 specific format that is selected in page 'My Stettings'
In page My Settings if date format is d/M/yyyy and the format I'm receiving from 3rd party app is also the same then this code doesn't throw any error.
If in My Settings Page date format is M/d/yyyy, d.M.yyyy etc and the format I'm receiving from 3rd party app is d-M-yyyy or any other than the format selected on My Settings page, then this AL Code doesn't work.
Is there any way to get current system's date format and evaluating the received date string (having any format) into date type?
Answers will be highly appreciated. Thanks for reading.