General information
Category:
Coding, syntax & commands
>Is there an "official" correct way to represent am empty time data type in code? For dates, {} or {//} seem accepted (and work).
>
>I started out with:
>
>{:}
>
>because TYPE( "{:}") returned "T", but I was somewhat horrified to learn that VFP5 considered EMPTY({:}) to be FALSE! The following all return TRUE (at least for now). Any idea what the right one is?
>
>{//:}
>{//::}
>
>-- Randy
Unlike a date value where there is no real world equivalent to the concept of 00/00/0000, there is a real world equivalent to a time value of 00:00:00, that is the stroke of midnight. That's why {//} gives you an empty date epression but {::} give you a non-empty time expression. {::} is the equivalent of midnight for the time component.
After doing some checking it appears that what I just wrote is true for direct assignment of a blank value to a datetime type variable but not for fields.
I created a cursor with a single datetime field and put the value {::} into that field. In fact that field returns true to ?empty(name of field). When a assigned the value of that field to a new variable, that variable showed up as empty too. So one way to do what you're trying to do is to create a cursor with a datetime field, assign it the value {::} and assign that field value to a variable. You end up with a datetime type variable that is empty.
-Dore
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only