Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Military Time
Message
De
01/08/2007 18:13:00
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
01/08/2007 17:50:48
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01245247
Message ID:
01245323
Vues:
37
>>Many good ideas, but yours seemed the simplest and returned the correct values under all scenarios. Thanks!
>>
>>For extra credit, is there a way to simplify the related code below? I'm stripping out the seconds.
>>
>>
>>m.SlotTime = RIGHT( "0" + ALLTRIM( slot_time( xx + show_from - 1 ) ), 5 )
>>m.DisplaySlotTime1 = Ttoc(Ctot(Transform(Dtos(Date()), '@R 9999-99-99') + 'T' + m.SlotTime), 2)
>>m.DisplaySlotTime2 = LEFT(m.DisplaySlotTime1,5) + ' ' + RIGHT(m.DisplaySlotTime1,2)
>>@ 2,2 SAY 'Date: ' + ALLTRIM( DTOC( disp_date ) ) + SPACE(10) + 'Time: ' + m.DisplaySlotTime2 COLOR ( nedit_color )
>>
>
>YES! Use UDFs with readable names and make it understandable. If the results are incorrect, fix that UDF and you're done.

Not sure I follow. So for all three algorithms call a function? Like...

m.SlotTime =GetSlotTime(xx,show_from)

Then have...

FUNCTION GetSlotTime

Etc...

I did do this, which I thought was a little more readable:
* Convert from 24-hour to 12-hour time format for display
m.SlotTime = RIGHT( "0" + ALLTRIM( slot_time( xx + show_from - 1 ) ), 5 )
m.DisplaySlotTime = Ttoc(Ctot(Transform(Dtos(Date()), '@R 9999-99-99') + 'T' + m.SlotTime), 2)

* Display Next Open Slot Date and Time
@ 2,2 SAY 'Date: ' + ALLTRIM( DTOC( disp_date ) ) + SPACE(10) + 'Time: ' + (LEFT(m.DisplaySlotTime,5) + ' ' + RIGHT(m.DisplaySlotTime,2)) COLOR ( nedit_color )
I've seen code where there were so many functions to do little things that it made it almost unreadable. Where do you draw the line?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform