I have this Time In and Time Out
Text1.text = Time in
Text2.text = Time out
Text3.text = Total number of hours work
My problem is how can I calculate the total time of work of an employee?
Example:
I put a 8:38 am in Time In then 5:00 pm in Time Out. I want to gather a code which can actually calculate the total number of hours work of an employee.
Because if I add this two numbers it will appear 13:38 instead of 7:22 total number of hours.
If any one know or have an idea please kindly post it.
Thank you in advance ^_^
you can try to use this one
where
dtpicker1 is you subtrahend and dtpicker2 is your minuend
Private Sub Command1_Click()
Me.Text1.Text = TimeDiff(Me.DTPicker1.Value, Me.DTPicker2.Value)
End Sub
Private Function TimeDiff(Time1 As String, Time2 As String) As String
Dim MinsDiff As String
Dim TheHours As String
MinsDiff = DateDiff("n", Time1, Time2)
'If midnight is between times
MinsDiff = IIf(MinsDiff < 0, MinsDiff + 1440, MinsDiff)
TheHours = Format(Int(MinsDiff / 60), "0")
MinsDiff = Format(MinsDiff Mod 60, "0")
TimeDiff = TheHours & ":" & MinsDiff
End Function
Thank you for your reply and I appreciate it.
Sir all I want is a Text1 and Text2 to be converted in the number of hours work. As simple as that.
Is there any way I can calculate it?
Web / System Developer
Contacts :
09327081978
recca_flame05@yahoo.com >>> Facebook/YM
ICCT Colleges Cainta Rizal
are those codes work thanks ^^
please do try to analyze more what you want to do... you can't get a no. of hours of work with out deducting the time out with the time in...
we also have the same problem i think..
i do also want to have the codes where a professor can see his or her personal account wherein there are his schedule of his class. and eventually make it TIME IN. After wards make it also TIME OUT. Where he can see in another label or text box how many hour/s did he spent teaching in whole day. please response if whoever knows the simple code using FORM only. NOT modules or anything. thanks
--aissa--
you can use the datediff or dateadd funtion of vb6
to calculate time. ^_^ aja.... hehehe
Hi Try This Link Sir! http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=69890&lngWId=1
and download the source code, this code is exactly what you want !!
Evan Millana
thank you kuya
u have to include the date also to get the actual number of hrs. used the datediff ().
Wow this is an Old forum !!! .I think u already got the solution ...
I hope this will help to readers and googlers
Create 2 Textboxes and one button
Private Sub Command1_Click()
MsgBox DateTime.DateDiff("n", Text1.Text, Text2.Text)
End Sub
'then divide it by 60 use this "\" not "/" ,to calculate hours and mod 60 to caculate minutes
'Ur var as string = Ur var as integer \ 60 & " Huors And " & varblah Mod 60 & " Minutes"
Download this file for complete demonstration <<-------------------------------<<<<<<<
>>>>>>>>------------------------------------------------------------------------------>>
from Evan Millana >>>>>------On error goto hell ok ok! ------------------>>
=E11-B11+IF(B11>E11,1)-AA11
b11= time in
e11 = time out
aA11 = 1HOUR BREAK IF HAVE ONLY
can have your code im trying to debug this same problem., but theres to much trash code on it
how to cr8 a time in time out system ?
what is the code?
import java.io.*;
{
import java.text.*;
import java.util.StringTokenizer;
public class Payroll
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String empCode;
System.out.print("Enter Employee Code: "); //Get employee Code
empCode = br.readLine();
displayInformation(empCode); //Call the methode display Information
setLogged(empCode);
}
public static void displayInformation(String ecode)throws IOException
{
DecimalFormat df=new DecimalFormat("0.00");
FileInputStream fs = new FileInputStream("employee.txt");
BufferedInputStream bf = new BufferedInputStream(fs);
DataInputStream dis = new DataInputStream(bf);
String line; //Get the data per line
String tempEmployee="";
int noofrecords=5;
String[] code = new String[noofrecords]; //Array of records
String[] employee = new String[noofrecords];
String[] level = new String[noofrecords];
int x=0,find=0;
double salary;
StringTokenizer st1; //Get the data in the text file
while(x
line = dis.readLine();
st1 = new StringTokenizer(line,","); //set comma as delimeter in the string
tempEmployee = st1.nextToken();
{
employee[x] = "";
for(int i=0;i
if(tempEmployee.charAt(i)=='_') // if character is underscore change it into space
employee[x] = employee[x] + " "; // else
employee[x] = employee[x] + tempEmployee.charAt(i);
}
code[x] = st1.nextToken();
level[x] = st1.nextToken();
x++;
}
for(int z=0;z
{
if(code[z].equals(ecode))
{
System.out.println("Employee Name: " + employee[z]);
System.out.println("Employee Name: " + code[z]);
System.out.println("Salary Level: Level " + level[z]);
if(level[z].equals("1")) //Check the level of the salary of the employee
salary=380;
else if(level[z].equals("2"))
salary=450;
else
salary=550;
System.out.println("Salary Rate: Php " + df.format(salary) + "/day");
find=1; //If find variable is equal to 1 then
//the statement inside the if statement below will not be executed;
}
}
if(find!=1)
System.out.println("Can't Find the Employee Number");
System.exit(0);
}
{
public static void setLogged(String empNo)throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String week[]={"Monday","Tuesday","Wednesday","Thursday","Frida y"};
String data = "",timein,timeout,otin,otout,res;
FileOutputStream fo = new FileOutputStream("test.txt"); // This will write the data in the text file
for(int x=0;x
System.out.println("Enter the time-in for " + week[x] + ": ");
timein = br.readLine();
System.out.println("Enter the time-out for " + week[x] + ": ");
timeout = br.readLine();
System.out.println("Is " + week[x] + " a Holiday? ");
res = br.readLine();
System.out.println("Enter the overtime-in for " + week[x] + ": ");
otin = br.readLine();
System.out.println("Enter the overtime-out for " + week[x] + ": ");
otout = br.readLine();
data = data+ "," + timein + "," + timeout + "," +otin + "," + otout; //Collect the data from the user of the program
}
data = empNo + data;
for(int x=0;x
{
fo.write(data.charAt(x)); //Write the line of data inside the text file
}
}
}
Hi,maybe this can help u,and make a new notepad...sana makatulong sayo..try it!
Please Help Me Po..
I need a system where in he dont need to input he's time of in .. he just need a command button and the time will just apper on textbox same with the time out .. supposedly he click again the time in, a msgbox will appear that "YOU ALREADY LOGGED IN" .. same with the time out .. i need it please for my project .. i need also the hours late , day absent and ot .. help me .. :'(
thank you po .. :)
contact me
09081805286
cedrickblas@yahoo.com
can you post codes using C# for payroll system...
please.....thanks
...may i get the command for the calculation of time in and timeout in fox pro because i don't know how to get the exact command for this program..please reply!!
thank you in advance...
for syntax command....
can you help me poe to have a C++ code in regarding with the time in and time out payroll system???
just contact me here:
09993970779
silentrockgrl@yahoo.com
tnx.....
Pages
Add new comment