From 104de44dc5a6c40f0491c15621615f9cfcb85ac6 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Mon, 13 Nov 2017 00:38:01 +0000 Subject: [PATCH] This closes #25! * Requires mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql --- Connections/database_functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Connections/database_functions.php b/Connections/database_functions.php index 01bdb0a..e045faa 100644 --- a/Connections/database_functions.php +++ b/Connections/database_functions.php @@ -477,6 +477,17 @@ function currency_format($value, $places = 2){ echo "$ "; if(is_null($value)) echo number_format(0,$places); else echo number_format($value,$places); +} + +// function to set time zone in mysql. +// Time zones must be setup in mysql for this to work: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql +set_time_zone(); +function set_time_zone() { + global $database_YBDB, $YBDB; + + mysql_select_db($database_YBDB, $YBDB); + $query = "SET time_zone='" . TIMEZONE . "';"; + $Recordset1 = mysql_query($query, $YBDB) or die(mysql_error()); } //function to convert server time to local time. To be used by all other current date / time requests.