[Gambas-user] DATE function Gambas 3.8.4 (Distro)
David Silverwood
the_watchmann at yahoo.com
Tue Apr 30 11:03:33 CEST 2019
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.)
On Monday, April 29, 2019, 7:24:06 PM GMT+2, Charlie Ogier <charlie at cogier.com> wrote:
Hi David,
Try this code: -
Dim dDate As Date
Dim sDate As New String[]
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.
If edtDate.Text Then
sDate = Split(edtDate.Text, "-")
dDate = Date(sDate[0], sDate[1], sDate[2])
edtDate.Text = Format$(dDate, "dd/mm/yyyy")
Endif
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.
sudo add-apt-repository -y ppa:gambas-team/gambas3 && sudo apt-get update && sudo apt-get -y install gambas3
Hope that helps,
Charlie
On 29/04/2019 14:40, David Silverwood via User wrote:
Hi 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. 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. My localisation settings for Linux Mint 18.3 KDE are correct. How can I convince Gambas to use the local date settings or at least format the date to the 'correct' format for our area?
The problem occurs when I load the dates from the database and try and format the dates to 'yyyy-mm-dd' using If edtDate.Text Then dDate = Val(edtDate.Text) edtDate.Text = Format$(dDate, "yyyy-mm-dd") Endif
Any but any suggestions/directions would be much appreciated.
Thanks
David
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190430/f64ce39e/attachment-0001.html>
More information about the User
mailing list