Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String conversion problem
Message
De
09/05/2005 07:35:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
09/05/2005 02:50:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Divers
Thread ID:
01012102
Message ID:
01012121
Vues:
35
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform