Browse Source

Fixes time behavior for DST, and adds a user-defined constant.

devel
Jonathan Rosenbaum 10 years ago
parent
commit
baf8f61d9e
  1. 26
      Connections/database_functions.php
  2. 2
      sql/populate.sql

26
Connections/database_functions.php

@ -6,6 +6,22 @@ define("STORAGE_PERIOD", 14);
define("ACCOUNTING_GROUP", "Sales");
define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts");
define("DEFAULT_SHOP_USER", "Volunteer");
/*
Choose your timezone from http://php.net/manual/en/timezones.php
Eastern ........... America/New_York
Central ........... America/Chicago
Mountain .......... America/Denver
Mountain no DST ... America/Phoenix
Pacific ........... America/Los_Angeles
Alaska ............ America/Anchorage
Hawaii ............ America/Adak
Hawaii no DST ..... Pacific/Honolulu
*/
define("TIMEZONE", "America/New_York");
//constants
define("PAGE_START_SHOP", "/start_shop.php");
@ -168,12 +184,14 @@ function currency_format($value, $places = 2){
else echo number_format($value,$places);
}
//function to convert server time to local time. To be used by all other current date / time requests.
//function to convert server time (UTC) to local time. To be used by all other current date / time requests.
function local_datetime(){
$hours_offset = 2;
$min_offset = 0;
return time() + ($hours_offset * 60 * 60 + $min_offset * 60);
// $hours_offset = UTC_TIME_OFFSET;
// $min_offset = 0;
//return time() + ( $hours_offset * 60 * 60 + $min_offset * 60 );
//offset hours; 60 mins; 60secs offset
date_default_timezone_set(TIMEZONE);
return time();
}
//function converts the current date/time into h:m am format

2
sql/populate.sql

@ -146,5 +146,3 @@ INSERT INTO transaction_types
ALTER TABLE transaction_log ADD paid tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE transaction_log ADD payment_type varchar(5) DEFAULT NULL;

Loading…
Cancel
Save