Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate Time Format
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00625685
Message ID:
00625784
Views:
9
Hello Joe,

>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.

As for the date - VFP will validate a date type variable. To see what happens, just browse the table, append a blank record, and try to enter an invalid date.

For validating the character type field that is holding a time string, your best bet is the BETWEEN() function. If the name of your time field is tyme, the following code would validate it:
BETWEEN(VAL(LEFT(tyme,2)),0,23).AND.BETWEEN(VAL(RIGHT(tyme,2)),0,60)
Obviously, if you are using a 12 hour format, the left side of the expression would have to be modified to accomodate that.

If you're using VFP6 or VFP7, consider a DATETIME variable, which combines both the date and the time in one field.

HTH
Randy Bosma
VFP - Because life is too short to code in something else...
Previous
Reply
Map
View

Click here to load this message in the networking platform