1 Mar 08:48
Re: StrToDate error
Hi, On 2/28/07, Michael Van Canneyt <michael <at> freepascal.org> wrote: > You should not have to worry about it. You use TDateTime, and convert to > string as needed as the user sees fit. > > I don't agree with Graeme's solution: it's not up to the programmer > to decide how the date/time is shown to the user. The user has decided > that for us when he configured his regional/localization settings. Both you and Peter V. misunderstood my post slightly. You don't have to force the user to see the date/time in a certain format. Though we opted for it after a length discussion. Storing the date/time as a string in the ISO 8601 format is forced and allows you to export data to another application without having to try and guess the date format in the new application (yyyymmdd, ddmmyyyy, mmddyyyy, etc). Once the string date/time is read and converted it to a TDateTime, the GUI can displays it in the way the user specified in their regional settings, but as soon as it goes back to the database or some file, it gets converted back to the ISO string format. So bottom line, the user sees the date/time it the format they prefer. This is the first choice. We opted to follow the ISO 8601recommendation for display as well, to help remove confusion between various date formats in digital or hardcopy form. Imagine the following case: The user in USA generates a report with date/time columns as a PDF(Continue reading)
hehe... ok reading my post again I can see it wasn't very clear. ISO
8601 is a recommendation, it doesn't force anything. The same goes
for the helper functions I wrote.
function tiDateTimeAsIntlDateStor(const ADateTime: TDateTime): string;
function tiDateTimeAsIntlDateDisp(const ADateTime: TDateTime): string;
function tiIntlDateStorAsDateTime(const AValue: string): TDateTime;
function tiIntlDateDispAsDateTime(const AValue: string): TDateTime;
After a length discussion in our company regarding previous versions
of our application, we had experienced a lot of confusion with date
> Only the 'build-in'-system is more flexible. You can set the format you
> want yourself. (including your ISO-standard.) So instead of rewriting
> everything in string-based fields, you could do a 'set
> dateformat=isoXXXX' or something similar when you open a connection...
Does this apply to code in stored procedures as well? I would think
it only works with whatever DB component you use.
RSS Feed