Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDF AMPM() is inconsistent???
Message
De
03/06/1998 04:36:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
03/06/1998 02:23:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00104276
Message ID:
00104290
Vues:
21
>I've written the following to mimic the Clipper function:
>
>
><STRONG>
>FUNCTION ampm
>    LPARAMETERS cTime
>    DO CASE
>        CASE cTime > '12'
>            cTime = STR(VAL(SUBSTR(cTime,1,2))-12,2) + SUBSTR(cTime,3,3) + ' pm'
>        CASE cTime = '12'
>            cTime = STR(VAL(SUBSTR(cTime,1,2))   ,2) + SUBSTR(cTime,3,3) + ' pm'
>        OTHERWISE
>            cTime = STR(VAL(SUBSTR(cTime,1,2))   ,2) + SUBSTR(cTime,3,3) + ' am'
>    ENDCASE
>    RETURN cTime
></STRONG>
>
>
>The problem is that this function is not recognized while the program is running...
>
>I 'watch' DTOC(DATE())+" "+AMPM(TIME()) in the debugger and it says "Expression could not be evaluated" but I can type ? DTOC(DATE())+" "+AMPM(TIME())in the command window and it prints fine ?!?!?!?!?!?
>
>How can this be? What's the difference?
>
>TIA
>
>Larry
Larry,
Too much work for AMPM (BTW I think there is a scope problem there).
cOldSysFormat = set("sysformat") 
nOldHours = set("hours")
cOldDateFormat = set("date")
set sysformats off
set date to dmy
set hours to 12
cTime = ttoc(datetime())
set hours to &nOldHours
set sysformat &cOldSysFormat
set date to &cOldDateFormat
return cTime
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform