<html><head></head><body><div class="ydpc0a296e2yahoo-style-wrap" style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 13px;"><div></div>
        <div>Hi Charlie</div><div><br></div><div>I also suspected it should work, but nope. I saved a screenshot of the result which I will attach.</div><div><br></div><div>This was the code:</div><div><div><div>    If edtDate.Text Then</div><div>        sDate = Left$(edtDate.Text, 10)</div><div>        $Date = Split(sDate, "/")</div><div>        dDate = Date($Date[2], $Date[0], $Date[1])</div><div>        edtDate.Text = Format$(dDate, "yyyy-mm-dd")</div><div>    Endif</div></div><br></div><div>Maybe it has something to do with the OS itself? My regional settings seem correct...</div><div><br></div><div><br></div>
        
        </div><div id="ydp2f6f3fa4yahoo_quoted_8274318810" class="ydp2f6f3fa4yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Thursday, May 16, 2019, 8:13:08 PM GMT+2, Charlie Ogier <charlie@cogier.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydp2f6f3fa4yiv9405876895"><div>
    <div class="ydp2f6f3fa4yiv9405876895moz-cite-prefix">Hi David,<br clear="none">
      <br clear="none">
      What are you getting from the database as the following code
      works: -<br clear="none">
      <br clear="none">
      <i><b>Public Sub Form_Open()</b></i><i><b><br clear="none">
        </b></i><i><b>Dim dDate As Date</b></i><i><b><br clear="none">
        </b></i><i><b>Dim sDate As New String[]</b></i><i><b><br clear="none">
        </b></i><i><b><br clear="none">
        </b></i><i><b>edtDate.Text =
          "05/16/2019"                             ''Is this what you
          get??</b></i><i><b><br clear="none">
        </b></i><i><b><br clear="none">
        </b></i><i><b> If edtDate.Text Then</b></i><i><b><br clear="none">
        </b></i><i><b>    edtDate.Text = Left(edtDate.Text, 10)</b></i><i><b><br clear="none">
        </b></i><i><b>   sDate = Split(edtDate.Text, "/")</b></i><i><b><br clear="none">
        </b></i><i><b>   dDate = Date(sDate[2], sDate[0], sDate[1])</b></i><i><b><br clear="none">
        </b></i><i><b>   edtDate.Text = Format$(dDate,
          "yyyy-mm-dd")          'Result: 2019-05-16</b></i><i><b><br clear="none">
        </b></i><i><b>   edtDate2.Text = Format$(dDate,
          "dd-mm-yyyy")         'Result: 16-05-2019</b></i><i><b><br clear="none">
        </b></i><i><b>   edtDate3.Text = Format$(dDate, "dddd dd mmmm
          yyyy")  'Result: Thursday 16 May 2019</b></i><i><b><br clear="none">
        </b></i><i><b>Endif</b></i><i><b><br clear="none">
        </b></i><i><b><br clear="none">
        </b></i><i><b>End</b></i><i><b><br clear="none">
        </b></i><br clear="none">
      <br clear="none">
      Charlie <br clear="none">
      <br clear="none">
      On 16/05/2019 17:47, David Silverwood via User wrote:<br clear="none">
    </div>
    <blockquote type="cite">
      </blockquote></div><div><div class="ydp2f6f3fa4yiv9405876895ydp93937884yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
        <div>and if I use today's date I get the following error...</div>
        <div>
          <div>
            <p style="margin:0px;">'Error 21 in
              FExpenses.btnLoad_Click.143</p>
            <p style="margin:0px;">The following error has occurred:</p>
            <div style="margin:0px;">Out of bounds'</div>
          </div>
          <div style="margin:0px;"><br clear="none">
          </div>
          <div style="margin:0px;">I think its stating that the month
            cannot be 16 and therefore out of bounds because I do not
            get this error when I use say 2019-05-05/ 2019-09-12 etc. As
            I said, my textbox swops the month and day around.</div>
          <div style="margin:0px;"><br clear="none">
          </div>
          <div style="margin:0px;">Please bear with me. I am currently
            learning Gambas.</div>
          <br clear="none">
        </div>
        <div><br clear="none">
        </div>
      </div>
      <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yahoo_quoted" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yahoo_quoted_8935663322">
        <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
          <div> On Thursday, May 16, 2019, 6:40:08 PM GMT+2, David
            Silverwood via User <a shape="rect" class="ydp2f6f3fa4yiv9405876895moz-txt-link-rfc2396E" href="mailto:user@lists.gambas-basic.org" rel="nofollow" target="_blank"><user@lists.gambas-basic.org></a>
            wrote: </div>
          <div><br clear="none">
          </div>
          <div><br clear="none">
          </div>
          <div>
            <div id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788">
              <div>
                <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydpdd45f520yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
                  <div>To add</div>
                  <div><br clear="none">
                  </div>
                  <div>if I do this, which I have also tried, it comes
                    close but still swops the month and day around...</div>
                  <div><br clear="none">
                  </div>
                  <div>
                    <div>
                      <div>    If edtDate.Text Then</div>
                      <div>        sDate = Left$(edtDate.Text, 10)</div>
                      <div>        $Date = Split(sDate, "/")</div>
                      <div>        Debug sDate = $Date[2] & "-"
                        & $Date[1] & "-" & $Date[0]</div>
                      <div>        edtDate.Text = sDate</div>
                      <div>    Endif</div>
                    </div>
                    <br clear="none">
                  </div>
                  <div>Changing $Date[1] and $Date[0] around makes no
                    difference whatsoever</div>
                  <div><br clear="none">
                  </div>
                  <div>Regards</div>
                  <div><br clear="none">
                  </div>
                  <div>David</div>
                  <div><br clear="none">
                  </div>
                </div>
                <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yahoo_quoted" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yahoo_quoted_8781085714">
                  <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                    <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788yqt5179636273" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788yqt11540">
                      <div> On Thursday, May 16, 2019, 6:31:07 PM GMT+2,
                        David Silverwood via User
                        <a shape="rect" class="ydp2f6f3fa4yiv9405876895moz-txt-link-rfc2396E" href="mailto:user@lists.gambas-basic.org" rel="nofollow" target="_blank"><user@lists.gambas-basic.org></a> wrote: </div>
                      <div><br clear="none">
                      </div>
                      <div><br clear="none">
                      </div>
                      <div>
                        <div id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808">
                          <div>
                            <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp2d98c143yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
                              <div>Hi Gianluigi</div>
                              <div><br clear="none">
                              </div>
                              <div>Are you referring to this portion:</div>
                              <div>
                                <div>
                                  <div> Randomize</div>
                                  <div>  $hConn.Begin()</div>
                                  <div>  For i = 0 To $nRecords</div>
                                  <div>    nCasual = Rand(0, 30)</div>
                                  <div>    sName = aFirstName[nCasual]</div>
                                  <div>    nCasual = Rand(0, 30)</div>
                                  <div>    sSurname = aLastName[nCasual]</div>
                                  <div>    y = Rand(1959, 2000)</div>
                                  <div>    m = Rand(1, 12)</div>
                                  <div>    d = Rand(1, 28)</div>
                                  <div>    hDate = Date(y, m, d)</div>
                                  <div>    hResult =
                                    $hConn.Create("tuser")</div>
                                  <div>    hResult!usnam = sName</div>
                                  <div>    hResult!ussur = sSurname</div>
                                  <div>    hResult!usdat = hDate</div>
                                  <div>    hResult.Update</div>
                                  <div>  Next</div>
                                </div>
                                <br clear="none">
                              </div>
                              <div>I actually found the code difficult
                                to decipher but looking at it again I
                                assume you are referring to hDate =
                                Date(y, m, d)?</div>
                              <div><br clear="none">
                              </div>
                              <div><br clear="none">
                              </div>
                              <div><br clear="none">
                              </div>
                            </div>
                            <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yahoo_quoted" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yahoo_quoted_8936458258">
                              <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                                <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808yqt5353588679" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808yqt00136">
                                  <div> On Thursday, May 16, 2019,
                                    6:25:09 PM GMT+2, Gianluigi
                                    <a shape="rect" class="ydp2f6f3fa4yiv9405876895moz-txt-link-rfc2396E" href="mailto:bagonergi@gmail.com" rel="nofollow" target="_blank"><bagonergi@gmail.com></a> wrote: </div>
                                  <div><br clear="none">
                                  </div>
                                  <div><br clear="none">
                                  </div>
                                  <div>
                                    <div id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451">
                                      <div>
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div dir="ltr">I had shown
                                              you the correct code you
                                              need to look at in
                                              Report1.</div>
                                            <div dir="ltr"><br clear="none">
                                            </div>
                                            <div>Regards</div>
                                            <div>Gianluigi<br clear="none">
                                            </div>
                                            <br clear="none">
                                            <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail_quote">
                                              <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451yqt9809881283" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451yqtfd95352">
                                                <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail_attr" dir="ltr">Il giorno
                                                  gio 16 mag 2019 alle
                                                  ore 16:17 David
                                                  Silverwood via User
                                                  <<a shape="rect" href="mailto:user@lists.gambas-basic.org" rel="nofollow" target="_blank">user@lists.gambas-basic.org</a>>
                                                  ha scritto:<br clear="none">
                                                </div>
                                                <blockquote class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">
                                                  <div>
                                                    <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail-m_-4058040158495589322ydp6791a4fdyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
                                                      <div>Ok, so I'm
                                                        back with the
                                                        same problem. It
                                                        seems to me
                                                        Gambas has a
                                                        template format
                                                        for a date and
                                                        trying to change
                                                        it is
                                                        impossible? As
                                                        soon as Gambas
                                                        sees it as a
                                                        date, it
                                                        reformats my
                                                        formatting back
                                                        to the incorrect
                                                        format and
                                                        renders all the
                                                        code useless. Is
                                                        this the way it
                                                        is supposed to
                                                        be? </div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div>I need my
                                                        date formatted
                                                        to sqlite
                                                        format, eg,
                                                        yyyy-mm-dd</div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div>However, soon
                                                        as I do that,
                                                        gambas switches
                                                        it to
                                                        mm/dd/yyyy.</div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div>My OS
                                                        regional
                                                        settings are
                                                        correct. Using
                                                        Mint 18.3 KDE
                                                        and Gambas 3.13
                                                        (Thanks Charlie
                                                        for the upgrade
                                                        tip)</div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div>The latter
                                                        format is
                                                        useless over
                                                        here and
                                                        inevitably
                                                        gambas reads the
                                                        day and month
                                                        wrong, by
                                                        switching it...
                                                        I've tried using
                                                        Split and in a
                                                        debug /print
                                                        statement I see
                                                        that it does do
                                                        exactly what I
                                                        need, but once
                                                        the format hits
                                                        the textbox,
                                                        Gambas actually
                                                        changes it back
                                                        to mm/dd/yyyy.
                                                        How do I stop
                                                        that? I tried
                                                        DIM'ing the
                                                        dates as Strings
                                                        but Gambas seems
                                                        to read dates as
                                                        dates even if
                                                        they are
                                                        dimensioned as
                                                        strings? (which
                                                        I know they are
                                                        'special'
                                                        strings of
                                                        course).</div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div>My sqlite3
                                                        database
                                                        complains
                                                        whenever I try
                                                        and save the
                                                        dates in
                                                        Gambas's
                                                        preferred
                                                        format.</div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div>I know I am
                                                        doing something
                                                        wrong since no
                                                        one else has
                                                        this issue....
                                                        but what?</div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div><br clear="none">
                                                      </div>
                                                      <div><br clear="none">
                                                      </div>
                                                    </div>
                                                    <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail-m_-4058040158495589322ydpe15f8925yahoo_quoted" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail-m_-4058040158495589322ydpe15f8925yahoo_quoted_8492039099">
                                                      <div>
                                                        <div> On
                                                          Tuesday, April
                                                          30, 2019,
                                                          11:05:06 AM
                                                          GMT+2, David
                                                          Silverwood via
                                                          User <<a shape="rect" href="mailto:user@lists.gambas-basic.org" rel="nofollow" target="_blank">user@lists.gambas-basic.org</a>>
                                                          wrote: </div>
                                                        <div><br clear="none">
                                                        </div>
                                                        <div><br clear="none">
                                                        </div>
                                                        <div>
                                                          <div id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail-m_-4058040158495589322ydpe15f8925yiv7748707307">
                                                          <div>
                                                          <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yiv5976075451gmail-m_-4058040158495589322ydpe15f8925yiv7748707307ydp65c9a003yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
                                                          <div>Thank you
                                                          very much
                                                          Charlie and
                                                          Gianluigi.
                                                          Those were
                                                          pointers in
                                                          the right
                                                          direction for
                                                          me! I really
                                                          appreciate
                                                          your help.
                                                          (Not to
                                                          mention I just
                                                          learned a lot
                                                          from both of
                                                          your code
                                                          too.)</div>
                                                          <div><br clear="none">
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                        </div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                </blockquote>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yqt9809881283" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yiv6465630808ydp655bf3c8yqtfd17783"><br clear="none">
                                      ----[ Gambas mailing-list is
                                      hosted by <a shape="rect" href="https://www.hostsharing.net                                         " rel="nofollow" target="_blank">https://www.hostsharing.net
                                      </a>]----<div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd60119"><br clear="none">
                                    </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd74163">
                                  </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd14991">
                                </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd00278">
                              </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd40378">
                            </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd03681">
                          </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd17665">
                        </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd82919">
                        <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yqt5353588679" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yiv5712419788ydp570e079yqt46446"><br clear="none">
                          ----[ Gambas mailing-list is hosted by <a shape="rect" href="https://www.hostsharing.net " rel="nofollow" target="_blank">https://www.hostsharing.net
                          </a>]----<br clear="none">
                        </div>
                      </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd73075">
                    </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd14896">
                  </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd26172">
                </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd85939">
              </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd76848">
            </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd52905">
            <div class="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yqt5179636273" id="ydp2f6f3fa4yiv9405876895ydp47a0b0f2yqt89443"><br clear="none">
              ----[ Gambas mailing-list is hosted by <a shape="rect" href="https://www.hostsharing.net " rel="nofollow" target="_blank">https://www.hostsharing.net
              </a>]----<br clear="none">
            </div>
          </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd11613">
        </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd11400">
      </div></div><div class="ydp2f6f3fa4yiv9405876895yqt4235639255" id="ydp2f6f3fa4yiv9405876895yqtfd34573">
      <br clear="none">
      <fieldset class="ydp2f6f3fa4yiv9405876895mimeAttachmentHeader"></fieldset>
      <pre class="ydp2f6f3fa4yiv9405876895moz-quote-pre">----[ Gambas mailing-list is hosted by <a shape="rect" class="ydp2f6f3fa4yiv9405876895moz-txt-link-freetext" href="https://www.hostsharing.net" rel="nofollow" target="_blank">https://www.hostsharing.net</a> ]----
</pre>
    
    <br clear="none">
  </div></div></div><div class="ydp2f6f3fa4yqt4235639255" id="ydp2f6f3fa4yqtfd29131"><br clear="none">----[ Gambas mailing-list is hosted by <a shape="rect" href="https://www.hostsharing.net " rel="nofollow" target="_blank">https://www.hostsharing.net </a>]----<br clear="none"></div></div>
            </div>
        </div></body></html>