Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DTOS and CENTURY Question
Message
De
20/08/2008 15:24:44
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
20/08/2008 15:15:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01340482
Message ID:
01340502
Vues:
10
>>These two CASE conditions return "20051013" as the NewFieldValue, regardless of the CENTURY setting. It is a function in a SQL statement column, if that matters.
>>
>>The value of FieldValue is:
>>
>>{^2005/10/13}
>>
>>					CASE EligCrit.FormatVal = 'YYYYMMDD'
>>						SET CENTURY ON
>>						NewFieldValue = STRTRAN( DTOS( FieldValue ), '/', '' )
>>
>>					CASE EligCrit.FormatVal = 'YYMMDD'
>>						SET CENTURY OFF
>>						NewFieldValue = STRTRAN( DTOS( FieldValue ), '/', '' )
>>
>
>From VFP 8 help (pretty sure it's the same in VFP 9)
>"The character string returned by DTOS( ) isn't affected by SET DATE or SET CENTURY"

I tried this:
					CASE EligCrit.FormatVal = 'YYYYMMDD'
						NewFieldValue = ALLTRIM(TRANSFORM(DTOS(FieldValue), '@R 99999999'))

					CASE EligCrit.FormatVal = 'YYMMDD'
						NewFieldValue = RIGHT(ALLTRIM(TRANSFORM(DTOS(FieldValue), '@R 99999999')),6)
But it seems like I shouldn't need t use the RIGHT on that. Am I missing something with the TRANSFORM, or is this acceptable?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform