[Gambas-user] Date formats

Benoit Minisini gambas at ...1...
Mon May 19 18:34:53 CEST 2008


On lundi 19 mai 2008, Paul Horechuk wrote:
> On May 18, 2008 04:27:07 pm Juan Jose Costello Levien wrote:
> > Hello Paul,
> >
> > I suppose you are looking for CDate? (
> > http://gambasdoc.org/help/lang/cdate?v3)
>
> Unfortunately, CDate behaves the same as Date, in the previous examples.
> CDate("05/15/08") --> 15/05/08
> CDate("15/05/08") --> Type mismatch: wanted Date, got String instead
>
> I would expect the passed format of mm/dd/yy to return mm/dd/yy and not
> dd/mm/yy. If not then there should be a control for the order.
>

There are three possibilites :

1) You don't care with the format, and the american format is not problem. You 
can use CDate() to convert from a string and CStr() to convert to a string.

2) You want to deal with the date format associated with the current language 
(System.Language). Then you must use Val() to convert from a string and Str() 
or PRINT to convert to a string.

3) You want a specific date format. You can use Format() to convert to a 
string, but converting from a string must be done "by hand".

Regards,

-- 
Benoit Minisini




More information about the User mailing list