Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate Time Format
Message
From
17/03/2002 16:28:43
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00625685
Message ID:
00633936
Views:
16
>>>>I have a table with a date field (D8) and a time field (C5 - HH:MM). Does Fox have a function to validate just the time field? I don't want to concatenate the fields, I need them to be separate.
>>>>
>>>>TIA!
>>>
>>>You can check it this way
 IF EMPTY(Ctot("01/01/2002 " + timefiled ))
>>>  * Time is incorrect
>>>ELSE
>>>ENDIF
It also depends on your definition of what is the valid time value in that field.
>>
>>Sergey,
>>
>>I was searching for some date validation stuff... and found this thread... does the above mean
>>
>>
>>lcTest = "35/35/2002"
>>
>>IF EMPTY( CTOD(lcTest))
>>  ** This date is bad???
>>ELSE
>> ** This date is good???
>>ENDIF
>>
>>
>>
>>So, to validate a string to date, just ask if is empty outside the conversion function??
>>
>It would work if SET DATE is set to anything but SHORT or LONG. In case when it's SHORT or LONG a date before {^1601-01-01} is invalid and generates an error.
lcSetDate = SET("date")
>SET DATE TO AMERICAN
>IF EMPTY( CTOD(lcTest))
>  ** This date is bad???
>ELSE
> ** This date is good???
>ENDIF
>SET DATE TO (lcSetDate )
>
Thank you very much... Date/Time validation testing is definately not a strong suit here... :-)

Ric
Previous
Reply
Map
View

Click here to load this message in the networking platform