Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDF AMPM() is inconsistent???
Message
De
03/06/1998 12:46:54
 
 
À
03/06/1998 04:36:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00104276
Message ID:
00104425
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

Thanks Cetin and Rod

But...

Rod...

The reason I'm in the debugger watch window in the first place is because the string DTOC(DATE())+" "+AMPM(TIME()) is "undefined" so I was trying to figure out why. It's still confusing that it prints from the command window but not through the program. I also discovered that TYPE( AMPM(TIME())) is "U" if that helps.

Cetin...

I need to generate documentation using a "Template" that is based on Clipper, so it uses the line DTOC(DATE())+" "+AMPM(TIME()) in several places. I was hoping to accomodate this syntax so I don't have to rewrite the templates.

Thanks again
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform