Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function to return a valid date
Message
From
08/11/2001 08:05:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
08/11/2001 07:53:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00578964
Message ID:
00578983
Views:
19
>You mean
>xx = "20011101"
>?date(val(left(xx, 4)), val(substr(xx,5,2)), val(right(xx,2)))
>aerror(ff) e.t.c. ?

Yes, sort of.

For the error handling, I think the following would be appropriate:
local llError
on error llError = .T.
date(val(...
on error
return not llError && return .T. if date is valid
>
>dim
>
>>>Hello friends,
>>>
>>>I would like to ask whether there is a way (function or something) which can determine that a specific string contains a valid date for instance :
>>>isvaliddate("20011101") would return .t.
>>>
>>>Thank you
>>>Dimitris
>>
>>Convert to a date with the date(year, month, day) function. Before VFP6, you have to use dtoc() instead.
>>
>>Trap for errors.
>>
>>HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform