View Issue Details

IDProjectCategoryView StatusLast Update
0037610FPCDocumentationpublic2020-09-03 00:24
ReporterWill B Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux amd64OSLinux Mint 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0037610: FormatDateTime does not use system locale settings by default
DescriptionOn a Linux system with locale set as en_us, FormatDateTime using the 'f' formatting literal produces: **Now : 20-8-20 13:12:02**. This is not the appropriate format for us_en. It should produce: **Now: 08-20-2020 13:12:02** or something similar.
Steps To ReproduceThis code produces: **Now : 20-8-20 13:12:02**

<code pascal>
Uses sysutils;

Begin
  Writeln ('Now : ', FormatDateTime('f', Now()));
End.
</code>

However, if you add 'clocale' to the Uses clause, the code produces a more appropriate: **Now : 08/20/2020 01:22:18 PM** for the en_us locale.
Additional InformationThe documentation page for FormatDateTime does not mention the need to use 'clocale' for locale-appropriate output, nor is there a Wiki page that mentions this.
TagsNo tags attached.
Fixed in Revision1737
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

Will B

2020-08-20 22:42

reporter   ~0125038

Perhaps a link to the 'clocale' reference page should be listed under 'See also' on Time and Date functions that are affected by this.

Bart Broersma

2020-08-20 22:49

reporter   ~0125039

On *nix systems defaultformatsettings is not initialize to your locale, unless you include clocale unit.

Michael Van Canneyt

2020-08-20 23:25

administrator   ~0125045

Actually, this is documented in
https://www.freepascal.org/docs-html/current/rtl/sysutils/localization.html

But I agree this should be mentioned more prominently, I will add this to several other locations.

Michael Van Canneyt

2020-09-03 00:24

administrator   ~0125324

Added a reference to the localization page in most functions that convert date/time/float/curr to a string format.

Issue History

Date Modified Username Field Change
2020-08-20 22:26 Will B New Issue
2020-08-20 22:42 Will B Note Added: 0125038
2020-08-20 22:49 Bart Broersma Note Added: 0125039
2020-08-20 23:22 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-08-20 23:22 Michael Van Canneyt Status new => assigned
2020-08-20 23:22 Michael Van Canneyt Category RTL => Documentation
2020-08-20 23:22 Michael Van Canneyt FPCTarget => -
2020-08-20 23:25 Michael Van Canneyt Note Added: 0125045
2020-09-03 00:24 Michael Van Canneyt Status assigned => resolved
2020-09-03 00:24 Michael Van Canneyt Resolution open => fixed
2020-09-03 00:24 Michael Van Canneyt Fixed in Version => 3.3.1
2020-09-03 00:24 Michael Van Canneyt Fixed in Revision => 1737
2020-09-03 00:24 Michael Van Canneyt FPCTarget - => 3.2.2
2020-09-03 00:24 Michael Van Canneyt Note Added: 0125324