[fpc-devel] Date and Time formatting via locale settings doesn't work under FPC 2.2.0

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Mar 10 14:24:10 CET 2008


Hi,

Reading the documentation about DateToStr() and DateTimeToStr(), it
mentions that it takes the locale and regional settings in
consideration when formatting the date and time.  I have a Linux PC
that used the USA location at setup. A Linux PC that has South Africa
as location (also specified in the installation setup). I also asked a
fellow Russian developer to test on his PC.

We used the following line as mentioned in the docs.

  Writeln(Format ('Today is: %s',[DateToStr(Date)]));

Output under Windows (russian):
Today is: 10.03.2008

Under Windows the formatting seems to work fine under all three PC's
tested. Date formats changed accordingly.


Output under Linux:
Today is: 10-3-08

We got the exact same output on all three PC's tested. So basically
the locale/region information is totally ignored!  Is the date format
hard-coded under Linux or is there something vital that we are missing
under Linux?

Formats as far as I know should have been:
  Russia:  dd.mm.yyyy
  USA:  mm-dd-yyyy    (I think)
  RSA:  dd/mm/yyyy    or   yyyy/mm/dd   (dependent on the OS used)


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list