Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change a single character to a year?
Message
From
17/11/2002 21:37:37
 
 
To
17/11/2002 21:21:25
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00723697
Message ID:
00723700
Views:
20
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,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform