/** * Get time components of datetime string * Extract the HH:MM[:SS] from datetime string * Returns the time components of a formatted date string. * We return an array as: * ["hours"] - Hours (0 - 23) * ["minutes"] - Minutes (0 - 59) * ["seconds"] - Seconds (0 - 59) * @param string $displaydate Descriptive display date string * @return array Time components */ function get_HMS($displaydate = "") { if ($displaydate == "") { // Return current time.. return timeNow(); } else { // Unpack string.. if (strstr($displaydate, " ")) { $dtbits = explode(" ", $displaydate); if (isset($dtbits[1])) { $ti = $dtbits[1]; } else { $ti = $dtbits[0]; } } else { $ti = $displaydate; } // Search for our time delimiter.. if (strstr($ti, ":")) { $delim = ":"; } else { $delim = ""; } // Only proceed if we have a delimiter. No delimiter // means there is no time in the string at all.. if ($delim != "") { $tibits = explode($delim, $ti); } // Extract results or default the values.. if (isset($tibits[0])) { $hrs = $tibits[0]; } else { $hrs = 0; } if (isset($tibits[1])) { $min = $tibits[1]; } else { $min = 0; } if (isset($tibits[2])) { $sec = $tibits[2]; } else { $sec = 0; } } // Return as a assoc. array $hms["hours"] = $hrs; $hms["minutes"] = $min; $hms["seconds"] = $sec; return $hms; }
include_once("./config.php"); include_once("./lib/loader.php"); $db=new mysql(DB_HOST, '', DB_USER, DB_PASSWORD, DB_NAME); // connecting to database // get settings $settings = SQLSelect('SELECT NAME, VALUE FROM settings'); $total = count($settings); for ($i = 0; $i < $total; $i ++) Define('SETTINGS_' . $settings[$i]['NAME'], $settings[$i]['VALUE']); // language selection by settings if (SETTINGS_SITE_LANGUAGE && file_exists(ROOT . 'languages/' . SETTINGS_SITE_LANGUAGE . '.php')) include_once (ROOT . 'languages/' . SETTINGS_SITE_LANGUAGE . '.php'); include_once (ROOT . 'languages/default.php'); if (defined('SETTINGS_SITE_TIMEZONE')) { ini_set('date.timezone', SETTINGS_SITE_TIMEZONE); } header ('Content-Type: text/html; charset=utf-8'); echo timeNow(); $db->Disconnect(); // closing database connection ?>