Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-05

ShortDateFormat

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Copeland

Hi all,

I am using the following bit of code to convert a date from an external source.

    var
            timestamp: TDateTime;
            event_date, event_time: string;
    begin
            ShortDateFormat := 'm/d/y';
            try
                timestamp := StrToDateTime(event_date + ' ' + event_time);
            except
                // error handling ...
            end;
    end;

However, the compiler warns that ShortDateFormat is deprecated. Is there another way to accomplish this?

Thanks,
Dave Copeland.

David Copeland
to David Copeland

Sorry, I think I just answered my own question :-! . Woult using the TFormatsetting variant of StrToDateTime be the "better way"?

Dave.

David Copeland wrote 25 lines
Hi all, I am using the following bit of code to convert a date from an external source. var timestamp: TDateTime; event_date, event_time: string; begin ShortDateFormat := 'm/d/y'; try timestamp := StrToDateTime(event_date + ' ' + event_time); except // error handling ... end; end; However, the compiler warns that ShortDateFormat is deprecated. Is there another way to accomplish this? Thanks, Dave Copeland. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Bart
to David Copeland
David Copeland wrote
Sorry, I think I just answered my own question :-! . Woult using the TFormatsetting variant of StrToDateTime be the "better way"?

Yes.

Bart

David Copeland
to Bart

Thanks Bart.

Bart wrote 8 lines
On 5/7/15, David Copeland wrote: > Sorry, I think I just answered my own question :-! . Woult using the > TFormatsetting variant of StrToDateTime be the "better way"? Yes. Bart