[Gambas-user] Date difficulties

Jacky jscops at ...11...
Tue Jul 1 07:31:28 CEST 2008


Le Saturday 28 June 2008 06:37:51 richard terry, vous avez écrit :
> Something I've never come to terms with which should be simple.
>
> I have a class containing items including a date eg as a simple example
> which dosn't exist and I don't use but will serve the purpose of the
> request:
>
> cOrder
>
> part as string
> date as date
>
> In a form I may have this sort of code
>
> Dim order as new cOrder
>
> and on the form, some textboxes e.g
> txtPart
> txtDate
>
> When I type into the box I want the contents to end up in the class:
>
> order.part = txtPart.text
> order.date = txtDate.text
>
> The program complains about invalid date.
>
> I.e all I want is a simple exmple of how to use a textbox to put a date in
> the correct format.
>
> Hope that's not too ambiguous.
>
> Thanks in advance.
>
> Richard

Hello Terry

txtDate.txt = "01.01.2008" (this is a french date format : dd.mm.yyyy)
order.date = Date(Right$(txtDate.txt, 4), Mid$(txtDate.txt, 4,2), 
Left$(txtDate.txt, 2))

I hope is that you want.

Jacky







More information about the User mailing list