Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String conversion problem
Message
From
09/05/2005 02:59:24
 
 
To
09/05/2005 02:50:26
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01012102
Message ID:
01012104
Views:
18
>Dear Experts
>
>Please correct this command line
>
>a=alltrim(substr(str(YEAR(date())),1,4))
>
>I want to extract last two characters of year i.e. 05
>
>Please help

Check the help on str()
&& breaking it down gives

? str(YEAR(date())) && returns a string of length 10, six spaces and 2005
?substr(str(YEAR(date())),1,4)  && results in 4 blanks
?alltrim(substr(str(YEAR(date())),1,4)) && returns the empty string

either
?substr(str(YEAR(date()),4),3,2)

or 
?substr(dtos(date()),3,2)
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform