If you use Delphi's DatePicker component, you'll see that it displays the year just like your DBGrids, so the problem has nothing to do with the BDE (Borland Database Engine). But when you set Windows' Regional Settings to display dates as mm/dd/yyyy and next start a Delphi application, date fields are displayed as mm/dd/yyyy. Problem solved? No, the user surely won't appreciate it if you enforce him to change his Windows settings, resulting in problems in other applications... Solution: the formats for dates and numbers in Delphi programs are defined by a set of global formatting variables. These variables are automatically set according to Windows' settings. As one of the first actions in your program, you can change these global variables to the desired formats, thus overriding Windows' settings (don't worry, the modified settings are only used in your application, they do not affect Windows' Regional Settings). If your application shows dates and/or floating point numbers, set the global formatting variables ShortDateFormat, DecimalSeparator, LongDateFormat, and so on... to the desired values. Do this right after the start of your application, for example in the OnCreate event handler of the main form. A project with examples of this technique is contained in the zip-file DFORMAT.ZIP in the Download section, under the heading Mini Tutorial Projects. |
|
| DelphiLand Club |
Subscribe to the DelphiLand Club and get:
|
TOP DelphiLand Club Membership DC Library Forum Forum Archives Crash Course Delphi Tips Source Code Downloads Links
© Copyright 1999-2006
Studiebureau Festraets