aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php6
-rw-r--r--include/dblayer/functions_sqlite.inc.php6
2 files changed, 12 insertions, 0 deletions
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index a1f0a7833..365083f0c 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -46,6 +46,7 @@ function pwg_db_connect($host, $user, $password, $database)
}
$link->sqliteCreateFunction('now', 'pwg_now', 0);
+ $link->sqliteCreateFunction('hour', 'pwg_hour', 1);
$link->sqliteCreateFunction('unix_timestamp', 'pwg_unix_timestamp', 0);
$link->sqliteCreateFunction('md5', 'md5', 1);
$link->sqliteCreateFunction('if', 'pwg_if', 3);
@@ -570,6 +571,11 @@ function pwg_now()
return date('Y-m-d H:i:s');
}
+function pwg_hour($datetime)
+{
+ return strftime('%H', $datetime);
+}
+
function pwg_unix_timestamp()
{
return time();
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index 9de81868d..72f539c92 100644
--- a/include/dblayer/functions_sqlite.inc.php
+++ b/include/dblayer/functions_sqlite.inc.php
@@ -55,6 +55,7 @@ function pwg_db_connect($host, $user, $password, $database)
}
$link->createFunction('now', 'pwg_now', 0);
+ $link->createFunction('hour', 'pwg_hour', 1);
$link->createFunction('unix_timestamp', 'pwg_unix_timestamp', 0);
$link->createFunction('md5', 'md5', 1);
$link->createFunction('if', 'pwg_if', 3);
@@ -582,6 +583,11 @@ function pwg_now()
return date('Y-m-d H:i:s');
}
+function pwg_hour($datetime)
+{
+ return strftime('%H', $datetime);
+}
+
function pwg_unix_timestamp()
{
return time();