Recent

Author Topic: strtodatetime function bug in Android  (Read 273 times)

las

  • New Member
  • *
  • Posts: 22
strtodatetime function bug in Android
« on: May 17, 2019, 01:52:30 am »
Hi!

This code not work in Android:

var
  d:TDateTime;
begin
  DefaultFormatSettings.ShortDateFormat:='dd.mm.yyyy';
  d:=strtodatetime('01.10.2019 01:23:44');
end.

But this work in Android:

var
  d:TDateTime;
begin
  DefaultFormatSettings.ShortDateFormat:='dd.mm.yyyy';
  d:=strtodatetime('01-10-2019 01:23:44');
end.

ASBzone

  • Full Member
  • ***
  • Posts: 239
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: strtodatetime function bug in Android
« Reply #1 on: May 17, 2019, 01:55:03 am »
Please define "does not work" in terms of error messages, etc

And please indicate versions of Lazarus and FPC in use...
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.5 r61666 / FPC v3.2.0-beta-r42593 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1903 (Build 18362.295)
Other Systems: Windows 10 Pro x64, Version 1809 or greater

las

  • New Member
  • *
  • Posts: 22
Re: strtodatetime function bug in Android
« Reply #2 on: May 17, 2019, 01:57:55 am »
Lazarus 1.8.0 FPC 3.04

App crush in Android without any messages when call strtodatetime

ASBzone

  • Full Member
  • ***
  • Posts: 239
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: strtodatetime function bug in Android
« Reply #3 on: May 17, 2019, 03:10:48 am »
Lazarus 1.8.0 FPC 3.04

App crush in Android without any messages when call strtodatetime

Well, I tested and it doesn't work in Windows, either:

An unhandled exception occurred at $004113B0:
EConvertError: "01.10.2019" is not a valid date format
  $004113B0
  $00411FDB
  $0041203E

Try the following instead:

Code: Pascal  [Select]
  1. var  d: TDateTime;
  2.  
  3. begin  
  4.   DefaultFormatSettings.ShortDateFormat :='dd.mm.yyyy';  
  5.   DefaultFormatSettings.DateSeparator := '.';
  6.   d := StrToDateTime('01.10.2019 01:23:44');
  7. end.
  8.  

It won't display as you expect, however.

Try it...
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.5 r61666 / FPC v3.2.0-beta-r42593 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1903 (Build 18362.295)
Other Systems: Windows 10 Pro x64, Version 1809 or greater

las

  • New Member
  • *
  • Posts: 22
Re: strtodatetime function bug in Android
« Reply #4 on: May 17, 2019, 06:41:53 pm »
thanks. It work )