Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String conversion problem
Message
From
09/05/2005 07:35:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
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:
01012121
Views:
33
>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

An interesting alternative is division by 100 (with remainder), done with the mod() function, or the equivalent percent operator:
? padl(year(date) % 100, 2, "0")
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform