I am having some trouble setting up a program that would allow me to just enter time in, in hours and minutes and enter time out, in hours and minutes and then do calculations on them somewhat like a time clock. Any help would be appreciated.
Thanks
Since there is no native Time variable or field type, you have two+ choices. You can use the DATETIME type and just ignore the date if you never cross days in your in / out calculations. DATETIME arithmetic is easy - it works in seconds. Or you can store your hours and minutes in one or two character fields (or one numeric field). Then it's not that tough to build the routines to calculate the differences between values. The ultimate 'best answer' is really dependent on your calculation and reporting needs.
Check out Sys(2). It converts a time string "10:31:20" into a integer 37880 that represents the number of seconds since midnight. You can then do math on the 2 values.
So You Will need 4 data entry blocks
Hr1, Mn1
Hr2, Mn2
This gives you the number of seconds on the clock,
All You have to do then is divide by 360 to get the hours.
Divid the remainder by 60 to get the number of minutes.
the remainder of that is the number of seconds.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.