[Gambas-user] Using dates in Gambas
Gianluigi
bagonergi at gmail.com
Wed May 22 14:32:52 CEST 2019
Il giorno mer 22 mag 2019 alle ore 11:29 David Silverwood via User <
user at lists.gambas-basic.org> ha scritto:
> Thanks Bruce. I will give it a try!
>
> Hi, Benoit. I have read the wiki, in fact, my browser currently opens on
> it. But Gambas/Ubuntu is not playing along. I don't know whether
> en_ZA.UTF-8 is not supported or badly supported but when gambas loads the
> date from the sqlite db it is loaded as mm/dd/yyyy hh:mm:ss before
> attempted conversion and mm/dd/yyyy after attempted conversion, and not as
> yyyy-mm-dd. My problem comes in with a user(s) having to update the
> database. It means we have to change the date back to sqlite3 format every
> time we update a record and with one record having four odd different dates
> that can become quite time consuming not to mention tedious. Every
> conversion so far I have attempted has resulted in Gambas literally
> 'arguing' and 'fixing' it for me...
>
> I'm a newbie at Gambas having come from a QB/VB6 world to C and Max
> Reason's xbasic and Freebasic. Having to rewrite this in any of the latter
> would result in hours of coding which honestly I would rather avoid.
>
> I am probably going to kick myself eventually for missing something small
> here but I think this is a good learning curve for me.
>
> Regards
>
> David
>
>
If you upload a date to a SQLite table with Gambas using this code:
hResult!birth = Date(1947, 4, 10, 15, 25, 00)
Actually you write this string in the table field '1947-04-10 15:25:00'
As you can see written in the console if you run the code I have attached
to this discussion.
Note: To see hours and minutes you need to change the code by adding them.
If you wish to show your client what he wrote in the table use:
Print Format(hResult["birth"], "yyyy-mm-dd hh:nn:ss")
But I don't understand why you should show the date this way.
Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190522/eaefa95f/attachment-0001.html>
More information about the User
mailing list