<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Thanks, John. That worked.<br><br>Sent from my iPhone</div><div><br>On Jul 6, 2016, at 10:43, John Landmesser <<a href="mailto:jmlandmesser@gmx.de">jmlandmesser@gmx.de</a>> wrote:<br><br></div><blockquote type="cite"><div>
  
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  
  
    <div class="moz-cite-prefix">On 05.07.2016 19:20, Larry Dalton
      wrote:<br>
    </div>
    <blockquote cite="mid:A6BB9980-4F9C-4608-B8B1-E76FEAF728E8@gmail.com" type="cite">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div><span></span></div>
      <div>
        <meta http-equiv="content-type" content="text/html;
          charset=utf-8">
        <div><span></span></div>
        <div>
          <div dir="ltr">
            <p style="margin-bottom:0in;line-height:100%">I use the
              following
              function to read a date from a Libre Office dbase file.
              The field is
              stored as</p>
            <p style="margin-bottom:0in;line-height:100%">a string, ie
              '04/08/2016'. </p>
            <p style="margin-bottom:0in;line-height:100%"><br>
            </p>
            <p style="margin-bottom:0in;line-height:100%">function
              db_date(const dog_base:tdbf;const
              t_field:string):tdatetime;</p>
            <p style="margin-bottom:0in;line-height:100%">var
              test_date:tdatetime;</p>
            <p style="margin-bottom:0in;line-height:100%">test_bool:boolean;</p>
            <p style="margin-bottom:0in;line-height:100%">test_string:string;</p>
            <p style="margin-bottom:0in;line-height:100%">begin {starts
              function db_date(const dog_base:tdbf;const
              t_field:string):tdatetime;}</p>
            <p style="margin-bottom:0in;line-height:100%">
              test_bool:=dog_base.FieldByName(t_field).Value<>null;</p>
            <p style="margin-bottom:0in;line-height:100%"> if test_bool
              then test_date:=dog_base.FieldByName(t_field).AsDateTime</p>
            <p style="margin-bottom:0in;line-height:100%"> else
              test_date:=now;</p>
            <p style="margin-bottom:0in;line-height:100%">
              result:=test_date;</p>
            <p style="margin-bottom:0in;line-height:100%">end; {ends
              function
              db_date(const dog_base:tdbf;const
              t_field:string):tdatetime;}</p>
            <p style="margin-bottom:0in;line-height:100%"> </p>
            <p style="margin-bottom:0in;line-height:100%">I am running
              lazarus
              1.6, on both Windows 8 and Linux Mint 17. The above
              function works
              fine on the Windows 8 box, but on the Linux Mint box, I
              get the
              following error: “04/08/2016” is not a valid date format.
              Why
              does it work on Windows but not Linux? How can I rewrite
              it to work
              on both? </p>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>I think thats due to "locales" defined the right way on Windows,
      but differs on Linux.</p>
    <p>Have a look at:</p>
    <p><a class="moz-txt-link-freetext" href="http://www.freepascal.org/docs-html/rtl/sysutils/dateseparator.html">http://www.freepascal.org/docs-html/rtl/sysutils/dateseparator.html</a><br>
    </p>
    <p><br>
    </p>
  

</div></blockquote><blockquote type="cite"><div><span>-- </span><br><span>_______________________________________________</span><br><span>Lazarus mailing list</span><br><span><a href="mailto:Lazarus@lists.lazarus-ide.org">Lazarus@lists.lazarus-ide.org</a></span><br><span><a href="http://lists.lazarus-ide.org/listinfo/lazarus">http://lists.lazarus-ide.org/listinfo/lazarus</a></span><br></div></blockquote></body></html>