<style>
p {
text-align: center;
font-size: 12px;
}
</style>
<?php
$w1="select * from pca_ffaa ";
$_ww1 = mssql_query($w1) or die ("Error Query [".$w1."]");
WHILE($_w1 = mssql_fetch_array($_ww1))
{
$b=$b+1;
$insert1= date('m/d/Y H:i:s',strtotime($_w1['insert_dt1']));
$timeout1 = date('m/d/Y H:i:s',strtotime("$insert1 +48 hours "));
//echo "<td align=right width=35>$ID</td>";
echo "<tr align='center'>";
echo "<td><font size=1>$b</font></td>";
echo "<td><font size=1>".trim($_w1['ser_sn'])."</font></td>";
echo "<td><font size=1>".trim($_w1['model'])."</font></td>";
echo "<td><font size=1>".trim($_w1['name_user'])."</font></td>";
echo "<td><font size=1>".trim($_w1['board'])."</font></td>";
echo "<td><font size=1>".trim($_w1['qty'])."</font></td>";
echo "<td><font size=1>".date('m/d/Y H:i:s',strtotime($_w1['insert_dt1']))."</font></td>";
echo "<td><font size=1>".trim($_w1['cqe_pic'])."</font></td>";
if(trim($_w1['cqe_status']) == '1')
{
echo "<td><font face='Arial Narrow' style='font-size: 14px' color=#33FF00><b>Done</b></font></td>";
}
else{
echo "<td><font face='Arial Narrow' style='font-size: 14px' color=#FF0000><b>Undone</b></font></td>";
}
?>
<script>
// Set the date we're counting down to
var insert1="<?php echo $insert1; ?>";
var timeout1="<?php echo $timeout1; ?>";
// Update the count down every 1 second
var x = setInterval(function() {
var countDownDate = new Date(timeout1).getTime();
var countDownDates = new Date().getTime();
// Get todays date and time
// Find the distance between now an the count down date
var distance = countDownDate - countDownDates;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "Time out";
}
}, 1000);
</script>
Tag : PHP, Ms SQL Server 2008, HTML, JavaScript, jQuery, FuelPHP