On Wed, 03 Dec 2014, Lewis Balentine wrote:
> Ref: http://gambaswiki.org/wiki/lang/cdate
> 
> Date = CDate ( Expression AS Variant ) AS Date
> Converts an expression (numerical Float or String) into a Date / Time.
> Be careful! The current localization is not used by this function.
> 
> Is there a reference for what string formats CDATE recognizes.
> The input date I have is in form "ccyymmdd".
> Changing it to to "ccyy/mm/dd"did not work.
> Reversing it to "dd/mm/ccyy"did not work.
> 
> Error is type mismatch: wanted date, got string instead.
> Date is "20141215" (aka 15 Dec 2014).
> 

I couldn't find a place where that's documented but you can safely assume
that the non-localised conversion functions (i.e. the "C<Type>()" ones) are
compatible. If you want to know the format of a string to put into CDate(),
try to put a date into CStr() and see what it gives you:

  $ gbx3 -e "CStr(Now)"
  12/03/2014 17:27:48.308

and I bet the date or time part is optional and the milliseconds part alone
is also optional (didn't test).

You can implement a simple parser for your custom date formats using Scan()
and the Date() function... I'll leave that to you ;-)

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to