Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Time sheet calculations
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00862910
Message ID:
00862921
Vues:
11
Hello Raymond,

Datetime will force users to enter a valid date & time without much checking on your part, as long as the users don't balk at the default input structure. You can also peform math calculation fairly easily.

If you use a text field HH:MM you need to check the range for hours and minutes, and generally you would convert to a decimal version to do the math.

EX: 12:30 = 12.50 (divide minutes by 60) and you also have to account for time that breaks over a boundry:

02:00 - 10:00 = 4.00 (add 12 to the hours if it rolls over)

I've done it both ways, easier with datetime, users liked entering the text method better, but only because of the code enforcing the input was more flexible because it was custom.

Bob

>What is the best way to do calculations with time?
>
>I have a time sheet to do where the users enter the time started such as 8:30 and the end time such as 13:20.
>Should I use a character field for entry formated 99:99 or is a datetime better?
>Are there pre existing functions to do the calculations?
>
>Thanks in advance.
>
>Raymond Larche
'If the people lead, the leaders will follow'
'War does not determine who is RIGHT, just who is LEFT'
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform