Ever had a trouble getting FileMaker Pro convert text to date reliably?
Last week I was helping my colleague to debug a solution that seemed to be swapping month/day values in some cases. When I checked the issue in detail I discovered a strange behavior in FileMaker’s calculation engine. Although the file was set to “always use file’s saved settings”, GetAsDate was using the system settings when converting text returned from a plug-in.
The file was created with US date settings (month/day/year) while my system was set to Czech formats (day.month.year). Using GetAsDate on a text constant, even in a data viewer, was correctly using the US formats. However, when converting a (text for sure) value returned from 24U SimpleDialog Plug-In, the system format was used for some strange reason. What a big surprise it was for me when I tried to concatenate a space to the text value, and it was converted correctly, using the US formats…
Try it out yourself
I have created a simple example that demonstrates this issue. Feeel free to download it and try it yourself:
Maybe a good reason to convert dates by hand rather than using GetAsDate…
Let(mdy = Substitute(the_text; ["/"; "¶"]; ["."; "¶"]); Date(GetValue(mdy; 1); GetValue(mdy; 2); GetValue(mdy; 3))
HTH


