Hi,
Currently im developing a payroll system now, but im getting a hard time how to calculate datetime from our attendance sheet (biometrics).. I do have connection to import our existing software which is our biometrics going to php mysql database. my problem is I do not have an idea how to calculate their attendance.
example
ID DEPARTMENT NAME EMPLOYEEID DATE/TIME
1 IT JON 100011 2012-04-02 06:00:00 aM
2 IT JON 100011 2012-04-02 06:00:00 PM
how do i manage their attendance or compute DATETIME field to get exactly salaries,
any ideas?
REGARDS ALL,
datetime conversion
Moderator: General Moderators
Re: datetime conversion
You want... the number of days since the date? Or what?
Re: datetime conversion
I want to calculate datetime to hours or days. for example
2012-04-02 06:00:00 aM
2012-04-02 06:00:00 PM
Result 1 days and/or 12 hours,
2012-04-02 06:00:00 aM
2012-04-02 06:00:00 PM
Result 1 days and/or 12 hours,
Re: datetime conversion
Here is a good place to look for a MySQL answer. I see two functions in there that will do it.
For a PHP answer it depends whether you have PHP 5.3 or not.
For a PHP answer it depends whether you have PHP 5.3 or not.
Re: datetime conversion
what is that functions?
Re: datetime conversion
DATEDIFF() and TIMEDIFF(). One for the number of days, the other for the number of hours.
-
litebearer
- Forum Contributor
- Posts: 194
- Joined: Sat Mar 27, 2004 5:54 am
Re: datetime conversion
@ requinix - I can see how timediff would work with the datetime in and datetime out in the same table row; however, OP seems to have times in and times out in different rows, Could you show example query how one could use that mysql function given the way the OP's data is setup?
OR would OP need to 'grab' data from each row as timestamp then subtract the two?
OR would OP need to 'grab' data from each row as timestamp then subtract the two?