[Gambas-user] CDATE
Lewis Balentine
lewis at ...3412...
Wed Dec 3 18:50:32 CET 2014
Thank you Tobi,
I went thought the international formats I knew and fell back to
"mm/dd/ccyyy".
I thought the US were the only ones that use that format (excluding the
military).
Old lesson: Never Assume.
>> $ gbx3 -e "Cstr(Now)"<<
One might use that to embed some basic syntax in a shell script.
Regards,
Lewis
On 12/03/2014 10:36 AM, Tobias Boege wrote:
> 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
>
More information about the User
mailing list