Consistent date formatting from MySQL

This commit is contained in:
laf
2015-05-22 13:38:52 +01:00
parent a5048cf185
commit 6496e6ece4
22 changed files with 53 additions and 28 deletions

View File

@@ -32,7 +32,7 @@ $pdf->AddPage('L');
$numresults = 250;
}
$full_query = "SELECT D.device_id,name,state,time_logged,DATE_FORMAT(time_logged, '%D %b %Y %T') as humandate $query LIMIT $start,$numresults";
$full_query = "SELECT D.device_id,name,state,time_logged,DATE_FORMAT(time_logged, '".$config['dateformat']['mysql']['compact']."') as humandate $query LIMIT $start,$numresults";
foreach (dbFetchRows($full_query, $param) as $alert_entry) {
$hostname = gethostbyid(mres($alert_entry['device_id']));

View File

@@ -46,7 +46,7 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT `S`.`schedule_id`, DATE_FORMAT(`S`.`start`, '%D %b %Y %T') AS `start`, DATE_FORMAT(`S`.`end`, '%D %b %Y %T') AS `end`, `S`.`title` $sql";
$sql = "SELECT `S`.`schedule_id`, DATE_FORMAT(`S`.`start`, '".$config['dateformat']['mysql']['compact']."') AS `start`, DATE_FORMAT(`S`.`end`, '".$config['dateformat']['mysql']['compact']."') AS `end`, `S`.`title` $sql";
foreach (dbFetchRows($sql,$param) as $schedule) {
$status = 0;

View File

@@ -39,7 +39,7 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT D.device_id,name AS alert,state,time_logged,DATE_FORMAT(time_logged, '%D %b %Y %T') as humandate,details $sql";
$sql = "SELECT D.device_id,name AS alert,state,time_logged,DATE_FORMAT(time_logged, '".$config['dateformat']['mysql']['compact']."') as humandate,details $sql";
$rulei = 0;
foreach (dbFetchRows($sql,$param) as $alertlog) {

View File

@@ -46,7 +46,7 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT `E`.*,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate $sql";
$sql = "SELECT `E`.*,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate $sql";
foreach (dbFetchRows($sql,$param) as $eventlog) {
$dev = device_by_id_cache($eventlog['host']);

View File

@@ -60,7 +60,7 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT S.*, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date $sql";
$sql = "SELECT S.*, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date $sql";
foreach (dbFetchRows($sql,$param) as $syslog) {
$dev = device_by_id_cache($syslog['device_id']);