Browse Source

FIX #3372 - Printing issue with Postgres and dates (SQL format)

After connecting to the database, we force datestyle to "ISO, YMD", so dates returned by the db will have a format compatible with Dolibarr functions.
This will fix dates printing issues in mostly all pages, with a postgres db configured with "SQL, DMY" as default.
tomours 10 years ago
parent
commit
9267fe367e
1 changed files with 1 additions and 0 deletions
  1. 1 0
      htdocs/core/db/pgsql.class.php

+ 1 - 0
htdocs/core/db/pgsql.class.php

@@ -410,6 +410,7 @@ class DoliDBPgsql extends DoliDB
 			$this->database_name = $name;
 			pg_set_error_verbosity($this->db, PGSQL_ERRORS_VERBOSE);	// Set verbosity to max
 		}
+		pg_query($this->db, "set datestyle = 'ISO, YMD';");
 
 		return $this->db;
 	}