Re: Date formats


Posted by webmaster Guido:

In Reply to: Date formats posted by Tayloe Nickey:

: How can I get dates to appear in a DBGrid as mm/dd/yyyy? Currently, my date fields appear as mm/dd/yy, and with Y2K coming, I want to display 4 digit years. I have gone into the BDE admin program and changed the FOURDIGITYEAR variable to TRUE, but this has seemingly had no effect. The table I am using is a Paradox 7 table. I went into Paradox and changed the date format to mm/dd/yyyy and now it works fine. It displays the date field with a 4 digit year. But the exact same date field in the exact same table is still displayed with a 2 digit year in Delphi Grids.

: Also, I want dates to appear in the DatePicker component as dd/mm/yyyy. I only know how to make it either dsShort (mm/dd/yy) or dsLong (December 1, 1999). I want it to be mm/dd/yyyy. HELP!!!!

The format in which dates are shown has nothing to do with the table or the BDE, it is defined by the global variables for "DateFormat".
As one of the first actions in your program, you should set these global variables, e.g. in the OnCreate event of the main form of your application. The file dformat.zip (in our Download section) contains a project with some examples.