seconds to min/sec
Posted: Fri Jan 28, 2011 10:47 am
Hi Guys,
I have the following piece of code:
The fields $esAlert and $esAlarm currently contain a number in seconds (e.g. 90). But I want to save this into minutes and seconds (e.g. 1:30), so I was looking to do:
But this doesn't seem to work. Is there a better way to achieve this?
I have the following piece of code:
Code: Select all
$ConfRes = mysql_query($query['query1']) ;
if ( !$ConfRes ) { $error = mysql_error();
print "<table><tr><th>ERROR HAS OCCURRED</th></tr>\"";
print "<tr><td>".$error."</td></tr></table>";
}
while($ConfRow = mysql_fetch_assoc($ConfRes)) {
$config = $ConfRow;
$sendEmail = $ConfRow['sendEmail'];
$emailAddress = $ConfRow['emailAddress'];
$pageRefresh = $ConfRow['pageRefresh'];
$vUpdate = $ConfRow['vUpdate'];
$vAlert = $ConfRow['vAlert'];
$vAlarm = $ConfRow['vAlarm'];
$esDelays = $ConfRow['esDelays'];
$esAlert = $ConfRow['esAlert'];
$esAlarm = $ConfRow['esAlarm'];
print $esAlarmM;
}
Code: Select all
$esAlertM = gmdate("i", $ConfRow['esAlert']);
$esAlertS = gmdate("s", $ConfRow['esAlert']);
$esAlarmM = gmdate("i", $ConfRow['esAlarm']);
$esAlarmS = gmdate("s", $ConfRow['esAlarm']);