Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

character time to real time conversion 1

Status
Not open for further replies.

CMcC

Programmer
Joined
Feb 5, 2002
Messages
196
Location
US
Hi -
I am writing a 'time card' program, where the user will 'log' in, but only like an 08:00pm to 05:00pm kinda thing....ie, we are not using this to track what time the employees actually log in ( or i would use datetime()). It is just a paperless solution to them writing in their time on a piece of paper.
So say emp1 comes in and logs in.
When I ask for their time, I will default to "08:00" with a radio button for "am" or "pm". The "am" or "pm" will be concatenated onto the character "08:00" when they select am or pm.

The problem that I am having - how to differentiate between the char times.

ie, if they enter that they came in at "08:00 AM" then left at "11:00 AM" - when they return and select a time earlier than "11:00 AM" for example, "09:00 AM" - I want to be able to compare that time to "11:00 AM" and say - "hey you didnt log out until "11:00 AM" - enter a later time" sorta thing.

The problem with using datetime() is that it records the actual time.
We are not using actual time, but just a time log.


Any suggestions
thanks in advance
cmcc
 
how about the following. . .
*You will need to compare the days to make sure someone
*isn't punching in at an earlier time on a different day

PunchOutTime = '1:00 pm'
TimeInNow = '11:45 am'
ComparePunchOutTime = (VAL(PunchOutTime)+IIF(ATC('pm',PunchOutTime)>0,12,0))*100+VAL(SUBSTR(PunchOutTime,ATC(':',PunchOutTime),2))
CompareTimeInNow = (VAL(TimeInNow)+IIF(ATC('pm',TimeInNow)>0,12,0))*100+VAL(SUBSTR(TimeInNow,ATC(':',TimeInNow),2))
IF ComparePunchOutTime>CompareTimeInNow
MESSAGEBOX("You can't punch back in earlier than you punched out")
ENDIF
 
Thanks rcpis1 - I will try this and let you know how it goes. I appreciate your time.
cmcc
 
>>*You will need to compare the days to make sure someone
*isn't punching in at an earlier time on a different day

I search for the date first, so this will never be a problem.


That is just what I was looking for!
Thanks so much!
cmcc
 
You are welcome!

I often ask questions and rarely get to be the first to respond with a solution that I know.

rcpis1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top