[fpc-pascal] date formating dificulty

Philippe philippe at quarta.com.br
Tue Nov 18 12:49:20 CET 2014


 

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 [1]; 

 const FormatSettings: TFormatSettings [2]


):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 

Links:
------
[1]
http://www.freepascal.org/docs-html/rtl/system/tdatetime.html
[2]
http://www.freepascal.org/docs-html/rtl/sysutils/tformatsettings.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141118/7cf24929/attachment.html>


More information about the fpc-pascal mailing list