Em 18.11.2014 09:49, Philippe escreveu:
> I wrote a program: > > - windows 8 32 bits > > - lazarus 1.2.4 ... fpc 2.6.4 > > then I copied it to another computer > > - windows 7 64 bits > > - lazarus 1.0.14 .... fpc 2.6.2 > > and got into trouble with dates format! programs behave diferent way, and what was working on the fisrt computer does not work properly in the second! > > I guess I need some tutorial (I looked for but did not find anything :( !) > > why formatDateTime( 'DD/MM/YYYY', now) returns 18-11-2014 and not 18/11/2014 ? > > strtodate( formatDateTime( 'DD/MM/YYYY', now)) works ok on the w 8 32 bits, but arise an exception on the w 7 64 bits. > > I am confused with the following syntax > > function FormatDateTime( > > const FormatStr: string; > > DateTime: TDateTime [2]; > > const FormatSettings: TFormatSettings [3] > > ):string; > > how does it work between two format especifications: FormatStr and FormatSettings ? > > appreciate any example of good programming pratise of data formating to avoid bad surprise moving program from an OS to another ! > > Philippe > > on http://www.freepascal.org/docs-html/rtl/sysutils/strtodate.html > > I found > > Program Example19; > > { This program demonstrates the StrToDate function } > > Uses sysutils; > > Procedure TestStr (S : String); > > begin > Writeln (S,' : ',DateToStr(StrToDate(S))); > end; > > Begin > > Writeln ('ShortDateFormat ',ShortDateFormat); > TestStr(DateTimeToStr(Date)); > TestStr('05'+DateSeparator+'05'+DateSeparator+'1999'); > TestStr('5'+DateSeparator+'5'); > TestStr('5'); > End. > > the compiler warns that ShortDateFormat is deprecated ... which is not informed in the doc ... > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [1] Links: ------ [1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [2] http://www.freepascal.org/docs-html/rtl/system/tdatetime.html [3] http://www.freepascal.org/docs-html/rtl/sysutils/tformatsettings.html
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal