Recent

Author Topic: Should FormatDateTime default formatting use system locale settings?  (Read 811 times)

dsiders

  • Sr. Member
  • ****
  • Posts: 379
Re: Should FormatDateTime default formatting use system locale settings?
« Reply #15 on: August 20, 2020, 11:50:00 pm »
And where do the Windows users get the information? The documentation is quiete unclear.

From the GetLocaleFormatSettings routine in sysutils.pp.
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1004
  • Former Delphi 1-7, 10.2 User
Re: Should FormatDateTime default formatting use system locale settings?
« Reply #16 on: August 21, 2020, 04:48:49 am »
The macOS situation, at least, is detailed in the Locale settings for macOS article, accessible from the Mac Portal.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

PascalDragon

  • Hero Member
  • *****
  • Posts: 2262
  • Compiler Developer
Re: Should FormatDateTime default formatting use system locale settings?
« Reply #17 on: August 21, 2020, 09:30:32 am »
This isn't a huge issue for me, because I just use the desired format string, but it seems weird that the default would not match my system locale.

If you don't specify a format string the default is C (the format of which is documented at the top of the format chars as short date plus long time format). This is Delphi compatible (see here). This should probably be documented in our documentation as well... (does anyone want to file a bug report for that? ;D Edit: Okay, filed here)

And where do the Windows users get the information? The documentation is quiete unclear.

For Windows the corresponding libraries are always linked to and thus it is done as part of the initialization of SysUtils. For other platforms (especially *nix ones) this is not done so that linking against the C library can be avoided if one wants to.
« Last Edit: August 21, 2020, 02:29:13 pm by PascalDragon »

 

TinyPortal © 2005-2018