Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Type a string date
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Miscellaneous
Thread ID:
01496168
Message ID:
01496210
Views:
60
This message has been marked as a message which has helped to the initial question of the thread.
>sorry naomi...
>
>we have a string.
>
>A = "20110114172907"
>B = "20110114"
>
>is a string with a datetime value ....or.... date value ?
>
>? something( a ) = 'T'
>
>? something( b ) = 'D'
>
>is better ?
>
May be:
a="20110114172907"

if type(a) = 'N' 
  try
      if len(a) = 8 && Possible date
            ldDate = date(val(substr(a,1,4)),val(substr(a,5,2)),val(right(a,2)))
            lcType = 'D'
     endif
        if len(a) =14 && Possible time
            ltDateTime = datetime(val(substr(a,1,4)),val(substr(a,5,2)),val(substr(a,7,2)), val(substr(a,9,2)),val(substr(a,11,2)),val(substr(a,13,2)) )
            lcType = 'T'
     endif
   catch
     lcType = 'N'
   endtry  
endif
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform