I am trying to write a script that pulls information from our MySQL database on employees that are currently clocked in. I am pulling everything fine, but am trying to clean up the output by breaking up the date and time from the clock in into seperate fields.
Below is the array that I use to get each employee, then starting with the $datein= line I try to break up the $starttime value into hours, minutes, month, etc. However when I display those "broken down" values in my table it shows me December 31, 1969 and some hour display (current GMT?) If I take out the $starttime from my $datein= line it defaults to current time and displays what I want.
How do I get the time returned from the database to show in this broken down format?
Thanks for any tips or pointers, just getting started teaching myself PHP so I could be way off the mark here. Feel free to give a slight slap upside the head to point me in a better direction!
Greg
MY CODE:
while ($newArray = mysql_fetch_array($clockedin)) {
// give a name to the fields
$empnum = $newArray['Employee_Number'];
$starttime = $newArray['date_time'];
$lastname = $newArray['Last_Name'];
$firstname = $newArray['First_Name'];
$datein = getdate($starttime);
$monthin = $datein[month];
$dayin = $datein[mday];
$yearin = $datein[year];
$hourin = $datein[hours];
$minutein = $datein[minutes];
Greg Hicks
VB.Net (Newbie) Programmer
Below is the array that I use to get each employee, then starting with the $datein= line I try to break up the $starttime value into hours, minutes, month, etc. However when I display those "broken down" values in my table it shows me December 31, 1969 and some hour display (current GMT?) If I take out the $starttime from my $datein= line it defaults to current time and displays what I want.
How do I get the time returned from the database to show in this broken down format?
Thanks for any tips or pointers, just getting started teaching myself PHP so I could be way off the mark here. Feel free to give a slight slap upside the head to point me in a better direction!
Greg
MY CODE:
while ($newArray = mysql_fetch_array($clockedin)) {
// give a name to the fields
$empnum = $newArray['Employee_Number'];
$starttime = $newArray['date_time'];
$lastname = $newArray['Last_Name'];
$firstname = $newArray['First_Name'];
$datein = getdate($starttime);
$monthin = $datein[month];
$dayin = $datein[mday];
$yearin = $datein[year];
$hourin = $datein[hours];
$minutein = $datein[minutes];
Greg Hicks
VB.Net (Newbie) Programmer