When calling the date function, or referencing database information from a 'date' field, is it possible to specify what format the date will be returned as? Windows has at least seven formats that I know of, two of which (mm/dd/yy and yy/mm/dd) are impossible to tell apart with my current code. I'm trying to isolate just the year value from the date, and it's causing problems for my programs when they get run on systems that don't have the same date format as my own. The dates get reformatted to the host system's format, which might not have the year in the same position(s). Anyone have any advice on this issue?

Thanks in advance,


You can use the FormatDateTime function to convert a TDateTime structure to a string with a formatting of your choice. While accessing database record fields use AsDateTime then FormatDateTime not AsString.

Example from Delphi 7 Help :
S := FormatDateTime('"The meeting is on " dddd, mmmm d, yyyy, " at " hh:mm AM/PM', Now + 0.125);

Loren Soth