1. Should I create a CUSTOM COMPONENT or should I use the WINAPI ??
2. This One gets the points, How do I change the Machines Regional Settings Shortdateformat ??
I need to display all dates in my app in dd/mm/ccyy format (company standard).
This is fine for any display (ie labels etc..) as I simply call the Delphi function FormatDateTime to format it correctly. E.g. FormatDateTime(‘dd/mm/yyyy’, TDATETIME);…
I however have a problem with the datetimepicker component.
The DateTimePicker uses the machines local shortdateformat to determine how the date is displayed (ie Regional Settings ShortDateFormat). I tried changing the Delphi global variable ShortDateFormat to “dd/mm/yyyy’ but it had no effect on the components display.
I’ve kinda look through the windows API functions calls to find something that will allow me to change the machines local shortdateformat, and haven’t really found anything that makes sense to me, something about LOCALES ???. Iam pretty new to using the Win API directly and would greatly appreciate someone pointing me in the right direction ??? The problem here is that if the user changes the machines local shortdateformat while my app is running I will have to trap the system message indicating that it has changed and then change it back to the format I require…. (mmmmm !!, not to kosher).
My another alternative would be to create my own component by inheriting TDATETIMEPICKER and forcing it to display the date as ‘dd/mm/yyyy’.
Perhaps I should consider using both as parts of the solution, changing the machines local shortdateformat using WinAPI functions and create a custom component, but refrain from trapping the system message should the user change the format while my app is running ????
WHAT DO YOU THINK ??
And for the points can some please tell me how or which function to use to change the regional settings shortdateformat !! pretty please ??
Y2K Issue regarding FormatDateTime, for Delphi 3.0.
NOTE : in delphi 3.0 calling formatdatetime with the machines local shortdateformat year part set as a 2 digit year (ie “YY”) and a date with a year of 2000+ will return an incorrect date..ie 1900.. instead of 2000.. To correct, this change Delphi’s global variable ShortDateFormat to a 4 year digit.
e.g. ShortDateFormat := 'DD/MM/YYYY';
The problem has been corrected in Delphi 5.....
Thanking everyone in advance !!!!