<html><head></head><body><div class="ydpeceed533yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div>Oops. typed too quickly... $Date is actually sDate all the way through. Was thinking of another form when I typed this.</div><div><br></div><div><br></div><div><br></div>
</div><div id="ydpc19f3443yahoo_quoted_8592594054" class="ydpc19f3443yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Thursday, May 16, 2019, 5:38:06 PM GMT+2, David Silverwood via User <user@lists.gambas-basic.org> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="ydpc19f3443yiv1254605509"><div><div class="ydpc19f3443yiv1254605509ydp87cdab7ayahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div><div><div>Dim dDate As Date</div><div>Dim $Date As New String[]</div><div><br clear="none"></div><div><br clear="none"></div><div> $Sql = "SELECT * FROM expenses WHERE supplier = '" & cboSupplier.Text & "' AND invoice = '" & edtInvoice.Text & "';"</div><div> </div><div> $Result = conMod.$Con.Exec($Sql) ' execute sql statement above</div><div><br clear="none"></div><div> edtRef.Text = $Result!REF</div><div> edtDate.Text = $Result!DATE</div><div> cboSupplier.Text = $Result!SUPPLIER</div><div> edtVatNo.Text = $Result!VAT_NO</div><div> edtInvoice.Text = $Result!INVOICE</div><div> edtAmount.Text = $Result!AMOUNT</div><div> edtVat.Text = $Result!VAT</div><div> cboType.Text = $Result!TYPE </div><div> edtCash.Text = $Result!CASH</div><div> edtChq.Text = $Result!CHEQ</div><div> edtCard.Text = $Result!CARD</div><div> edtEft.Text = $Result!EFT</div><div> edtCr.Text = $Result!CREDIT</div><div> edtOs.Text = $Result!OUTSTANDING</div><div> edtOrderDate.Text = $Result!ORDER_DATE</div><div> edtOrderNo.Text = $Result!ORDER_NO</div><div> cboTerms.Text = $Result!TERMS</div><div> edtDeliveryDate.Text = $Result!DELIVERY_DATE</div><div> edtDeliveryNo.Text = $Result!DELIVERY_RECEIPT</div><div> edtSettlement.Text = $Result!SETTLEMENT</div><div> edtDueDate.Text = $Result!DUE_DATE</div><div> edtChqNo.Text = $Result!CHQ_NO</div><div> edtDatePaid1.Text = $Result!DATE_PAID</div><div> edtAmtPaid1.Text = $Result!PAID</div><div> edtDatePaid2.Text = $Result!ADD_PAYM_DATE</div><div> edtAmtPaid2.Text = $Result!ADD_PAYM</div><div> edtComments.Text = $Result!COMMENT</div><div> cboDescription.Text = $Result!DESCRIPTION</div><div> </div><div> If edtDate.Text Then</div><div> edtDate.Text = Left(edtDate.Text, 10) 'for some reason gambas uses mm/dd/yyyy hh:mm</div><div> $Date = Split(edtDate.Text, "/") 'split the date into sections to play with the date structure</div><div> dDate = Date(sDate[2], sDate[0], sDate[1]) 'because gambas switches it around, try and switch it to correct format, eg yyyy mm dd</div><div> edtDate.Text = Format$(dDate, "yyyy-mm-dd") ' converts it back to the proper format... i hope</div><div> Endif</div><div> </div></div>I suppose I'm doing this the long way (database and sql coding) but having come from a freebasic/ C and xbasic background this tends to make more sense to me. Never did this in VB6 as sqlite never existed back then.</div><div><br clear="none"></div><div>Thanks for looking into this for me, Charlie.</div><div><br clear="none"></div><div>David</div><div><br clear="none"></div>
</div><div class="ydpc19f3443yiv1254605509ydp91e25eeayahoo_quoted" id="ydpc19f3443yiv1254605509ydp91e25eeayahoo_quoted_8821840595">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div class="ydpc19f3443yiv1254605509yqt9642612831" id="ydpc19f3443yiv1254605509yqt73331"><div>
On Thursday, May 16, 2019, 5:25:07 PM GMT+2, Charlie Ogier <charlie@cogier.com> wrote:
</div>
<div><br clear="none"></div>
<div><br clear="none"></div>
<div><div id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923"><div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923moz-cite-prefix">Hi David,<br clear="none">
<br clear="none">
Can you create and post some code that demonstrates the problem.
That will give us something to work with.<br clear="none">
<br clear="none">
Charlie<br clear="none">
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923yqt2804369946" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923yqtfd93886"><br clear="none">
On 16/05/2019 15:16, David Silverwood via User wrote:<br clear="none">
</div></div><div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923yqt2804369946" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923yqtfd62094">
<blockquote type="cite">
</blockquote></div></div><div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923yqt2804369946" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923yqtfd08516"><div><div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydp6791a4fdyahoo-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="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yahoo_quoted" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yahoo_quoted_8492039099">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On Tuesday, April 30, 2019, 11:05:06 AM GMT+2, David
Silverwood via User <a shape="rect" class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923moz-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="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307">
<div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp65c9a003yahoo-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><br clear="none">
</div>
</div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyahoo_quoted" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyahoo_quoted_6751442980">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307yqt7436755736" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307yqt92555">
<div> On Monday, April 29, 2019, 7:24:06 PM GMT+2,
Charlie Ogier <a shape="rect" class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923moz-txt-link-rfc2396E" href="mailto:charlie@cogier.com" rel="nofollow" target="_blank"><charlie@cogier.com></a> wrote:
</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190">
<div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190moz-cite-prefix">Hi
David,<br clear="none">
<br clear="none">
Try this code: -<br clear="none">
<br clear="none">
Dim dDate As Date<br clear="none">
Dim sDate As New String[]<br clear="none">
<br clear="none">
edtDate.Text = "2019-04-29" 'I
presume this is the format you get so you
can take this line out. It was for me to
test.<br clear="none">
<br clear="none">
If edtDate.Text Then<br clear="none">
sDate = Split(edtDate.Text, "-")<br clear="none">
dDate = Date(sDate[0], sDate[1],
sDate[2])<br clear="none">
edtDate.Text = Format$(dDate,
"dd/mm/yyyy")<br clear="none">
Endif<br clear="none">
<br clear="none">
If you use the ppa you can have the latest
version of Gambas. Run the following
command in Terminal and Gambas 3.13.0 will
install. You will need a reasonable
internet connection.<br clear="none">
<br clear="none">
<span style="color:rgb(0, 0, 0);font-family:Ubuntu;font-size:medium;font-style:normal;font-weight:400;letter-spacing:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;text-decoration-color:initial;display:inline !important;float:none;">sudo
add-apt-repository -y
ppa:gambas-team/gambas3 && sudo
apt-get update && sudo apt-get
-y install gambas3<span> </span></span><br clear="none" style="color:rgb(0, 0, 0);font-family:Ubuntu;font-size:medium;font-style:normal;font-weight:400;letter-spacing:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;text-decoration-color:initial;">
<br clear="none">
Hope that helps,<br clear="none">
<br clear="none">
Charlie<br clear="none">
<br clear="none">
On 29/04/2019 14:40, David Silverwood via
User wrote:<br clear="none">
</div>
<blockquote type="cite"> </blockquote>
</div>
<div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190yqt1933288209" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190yqt05380">
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
<div>Hi</div>
<div>I'm new to the forum so please
forgive any mistakes in protocol. I am
also pretty new to Gambas and have a
lot to learn, so please forgive once
again any stupid questions or
mistakes.</div>
<div>Am trying to get Gambas dates to
work for me. I have a SQLite3 database
and as we know SQLite dates are stored
as YYYY-MM-DD. It seems Gambas dates
are stored MM-DD-YYYY which in South
Africa doesn't work as our local dates
are stored dd-mm-yyyy. Now, when I
format$ my dateboxes/textboxes to read
yyyy-mm-dd, depending on the date, I
either get a blank box or the month
and day are swopped and therefore also
renders the date unusable here. </div>
<div>My localisation settings for Linux
Mint 18.3 KDE are correct.</div>
<div>How can I convince Gambas to use
the local date settings or at least
format the date to the 'correct'
format for our area?</div>
<div><br clear="none">
</div>
<div>The problem occurs when I load the
dates from the database and try and
format the dates to 'yyyy-mm-dd' using</div>
<div><span> </span>
<div> If edtDate.Text Then</div>
<div> dDate = Val(edtDate.Text)</div>
<div> edtDate.Text = Format$(dDate,
"yyyy-mm-dd")</div>
<div> Endif</div>
<br clear="none">
</div>
<div>Any but any suggestions/directions
would be much appreciated.</div>
<div><br clear="none">
</div>
<div>Thanks</div>
<div><br clear="none">
</div>
<div>David</div>
</div>
</div>
<br clear="none">
<fieldset class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190mimeAttachmentHeader"></fieldset>
<pre class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190moz-quote-pre">----[ Gambas mailing-list is hosted by <a shape="rect" class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyiv4049803190moz-txt-link-freetext" href="https://www.hostsharing.net" rel="nofollow" target="_blank">https://www.hostsharing.net</a> ]----
</pre>
<br clear="none">
</div>
</div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyqt1933288209" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yiv7748707307ydp8cad57bbyqt38177"><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>
</div>
</div>
</div>
<div class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yqt7436755736" id="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923ydpe15f8925yqt25888"><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>
<br clear="none">
<fieldset class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923mimeAttachmentHeader"></fieldset>
<pre class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923moz-quote-pre">----[ Gambas mailing-list is hosted by <a shape="rect" class="ydpc19f3443yiv1254605509ydp91e25eeayiv0459847923moz-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="ydpc19f3443yiv1254605509ydp91e25eeayqt2804369946" id="ydpc19f3443yiv1254605509ydp91e25eeayqtfd18135"><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>
</div></div></div><div class="ydpc19f3443yqt9642612831" id="ydpc19f3443yqt05953"><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>