DateTime Error

Post your Gambas programming questions here.
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

DateTime Error

Post by Quincunxian »

I had this error and want to confirm that its not just me.
Can someone else please try this with a DateTime box; if it is a real bug, I'll log it formally.
DateTimeBox.Value = CDate("01/01/2019")
Returns an error even though both are date Types.
Error returned is : "Type mismatch: Wanted Date , got string instead."

Gambas=3.12.90
OperatingSystem=Linux
Kernel=4.15.0-46-generic
Architecture=x86_64
Distribution=Ubuntu 18.04.2 LTS
Desktop=UBUNTU:GNOME
Theme=Gtk
Language=en_AU.UTF-8
Cheers - Quin.
I code therefore I am
User avatar
Got2BeFree
Posts: 91
Joined: Saturday 26th November 2016 2:52am
Location: Lost

Re: DateTime Error

Post by Got2BeFree »

Where are you getting a DateTime box? The only thing I can find is a ValueBox with the type set to DateTime. Maybe I'm missing a component that has that?
sholzy

I'm wondering around lost in the past, not knowing where the present is.
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: DateTime Error

Post by Quincunxian »

Hey Sholzy,
Got actual control name wrong.....

DateBox (gb.form)
This control allows to edit a date value. It provides a little button that displays a calendar popup.

Edit: in the 'Chooser' tab.
Cheers - Quin.
I code therefore I am
User avatar
gambix
Posts: 5
Joined: Sunday 25th September 2016 5:51pm
Location: France
Contact:

Re: DateTime Error

Post by gambix »

You must to share more code to allow us to understand your error. Tested here without problem.

Also the date must be in us style mm/dd/yyyy. in other case it return the message you have

I can just say the pb is around your use of CDate
:-P
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: DateTime Error

Post by stevedee »

Quincunxian wrote: Tuesday 12th March 2019 11:40pm I had this error and want to confirm that its not just me.
Can someone else please try this with a DateTime box; if it is a real bug, I'll log it formally...
No, it seems to work as expected for me on 3.12.90 (...and on 3.12.2).

The error message: "Type mismatch: Wanted Date , got string instead."
...is a funny one, because I often see this when the error is unrelated to this description (its almost like a fall-back error).


Edit: I'm running 3.12.90 on Lubuntu 18.10 with that new LXQt desktop
User avatar
Cedron
Posts: 156
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: DateTime Error

Post by Cedron »

I did this in a Form_Open():
        Dim d As DateBox
        
        d = New DateBox(Me)

        d.Value = CDate("01/01/2019")
        
        Print d.Value
        
        d.X = 100
        d.Y = 100
        d.W = 100
        d.H =  20
        
        d.Show()

I got this in the console:

Code: Select all

12/31/2018 00:00:00
The date was also 12/31/2018 on the form.

Looks like a bug to me.

It also raises the question, how does one place a Form control on the form at design time if it isn't in one of the panels to the right?

Ced

3.12.2 (Behind the front lines.)
.... and carry a big stick!
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: DateTime Error

Post by cogier »

I tried this and it works as expected. Is this a language problem?

I am using en_GB.UTF-8 (British)
Stevedee en_GB.UTF-8 (British) - I presume
Quincunxian en_AU.UTF-8 (Austrailia)
Cedron en_US.UTF-8 (USA) - I presume
Sholzy en_US.UTF-8 (USA) - I presume

Just a thought!
User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: DateTime Error

Post by jornmo »

@Cedron .Move() does what you four lines did in one :)

http://gambaswiki.org/wiki/comp/gb.qt4/control/move
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: DateTime Error

Post by cogier »

@Cedron .Move() does what you four lines did in one
I did not need either the following worked fine: -
Public Sub Form_Open()
Dim d As DateBox

d = New DateBox(Me)
d.Value = CDate("01/01/2019")
Print d.Value

End
User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: DateTime Error

Post by jornmo »

cogier wrote: Wednesday 13th March 2019 11:45am I did not need either the following worked fine: -
Sure, but that's another story ;)
Post Reply