[fpc-pascal] FormatDatetime is not respecting the specified pattern

Luciano de Souza luchyanus at gmail.com
Wed Feb 1 04:23:55 CET 2012


     Hello listers,

  A strange error came up when formating a date. See this code:
writeln(formatdatetime('dd/mm/YYYY', now));
The answer should be: 31/01/2012
The answer was: 31-01-2012
I did one test else:
writeln(formatdatetime('dd$mm$YYYY', now));
The answer was: 31$01$2012
Yes, the problem seems to be related to the backslash.
DefaultFormatSettings.DateSeparator := '/';
writeln(formatdatetime('dd/mm/YYYY', now));
The answer was: 31/01/2012
Right! That's the answer. But it was necessary to setup the settings 
manually.
The test was done with Freepascal 2.4.4 and Ubuntu 10.10.
Does someone know what is my mistake?
Regards,
Luciano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120201/57e669ff/attachment.html>


More information about the fpc-pascal mailing list