Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to change a single character to a year?
Message
 
 
À
17/11/2002 21:21:25
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00723697
Message ID:
00723700
Vues:
21
This message has been marked as the solution to the initial question of the thread.
Hi, Henry.

>I extract the data from a sdf file and populate a table and then process as follows:
>
>
mDayOfService = SUBSTR(ConvertThis.LineItem,53,2)
>mMonthOfService = SUBSTR(ConvertThis.LineItem,56,2)
>mYearOfService = SUBSTR(ConvertThis.LineItem,59,1) &&the document only provides 1 digit for the year
>
>How do I take the above information and convert it to read, say MM/DD/YYYY? Specially when only 1 digit of the year is available to me from teh source document.

Use the date() function. This is the best way to express a date value without having to worry about SET DATE settings.
mDayOfService   = val( SUBSTR(ConvertThis.LineItem,53,2) )
mMonthOfService = val( SUBSTR(ConvertThis.LineItem,56,2) )
mYearOfService  = val( SUBSTR(ConvertThis.LineItem,59,1) )

* Assuming the 1 digit year is from this century
m.ServiceDate = date( 2000 + mYearOfService, mMonthOfService, mYearOfService )
Hope this helps,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform