Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Type a string date
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Divers
Thread ID:
01496168
Message ID:
01496210
Vues:
62
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform