View Issue Details

IDProjectCategoryView StatusLast Update
0038448FPCDocumentationpublic2021-03-14 00:23
Reporterwp Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Fixed in Version3.3.1 
Summary0038448: Add documentation of the '?' ScanDateTime parameter
DescriptionScanDateTime is a very powerful function to convert strings to date/time values. However, it is hard to apply in some cases. A discussion in the forum (https://forum.lazarus.freepascal.org/index.php/topic,53207.msg393306.html) showed me today that there is a format string parameter that I never have seen before.

Please add the following text to the documentation of the ScanDateTime function (after "Description")

---------------

In addition to the format characters used by the [[FormatDateTime]] function it is also allowed to add at '?' symbol to indicate an arbitrary character.

Examples:
dt := ScanDateTime('dd-mm-yyyy', '02-01-2021');
dt := ScanDateTime('hh:nn:ss.zzz', '12:05:32.891');
dt := ScanDateTime('mmmm dd??, yyyy, hh:nn ampm', 'April 2nd, 2014, 06:57 pm');


TagsNo tags attached.
Fixed in Revision1804
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

delfion

2021-02-07 19:52

reporter   ~0128809

To clariify things further:
  fmt:=DefaultFormatSettings;
  fmt.DateSeparator:='-';
  fmt.TimeSeparator:='.';
  fmt.TimeAMString:='a.m.';
  fmt.TimePMString:='p.m.';
  scandatetime('hh'0000039'h'0000039' q nn"m"','12h q 54m',fmt);
  quoted char or text is compared as is. 0000039 can be used too. It is necessary only with formatting chars.
  Time separator token is : and date separator token is /. Actual value is however taken from formatsettings, defaul of supplied.
  scandatetime('yyyy/mm/dd','2021-07-02',fmt);

  'am/pm','a/p' formatsettings value does not affect
   scandatetime('hh:mm am/pm','6.30 pm',fmt);
   scandatetime('hh:mm a/p','6.30 p',fmt);
  'ampm' value is taken from formatsettings
  scandatetime('hh:mm ampm','6.30 p.m.',fmt);
tab char 0000009 skips white space block (0000010 0000013 0000032)

Michael Van Canneyt

2021-02-08 09:44

administrator   ~0128819

Thanks for the report, I improved the documentation.
Should become visible in the daily docs tomorrow.

Issue History

Date Modified Username Field Change
2021-02-06 22:47 wp New Issue
2021-02-06 22:47 wp Status new => assigned
2021-02-06 22:47 wp Assigned To => Michael Van Canneyt
2021-02-07 19:52 delfion Note Added: 0128809
2021-02-08 09:44 Michael Van Canneyt Status assigned => resolved
2021-02-08 09:44 Michael Van Canneyt Resolution open => fixed
2021-02-08 09:44 Michael Van Canneyt Fixed in Version => 3.3.1
2021-02-08 09:44 Michael Van Canneyt Fixed in Revision => 1804
2021-02-08 09:44 Michael Van Canneyt FPCTarget => 3.2.2
2021-02-08 09:44 Michael Van Canneyt Note Added: 0128819
2021-03-14 00:23 wp Status resolved => closed