Last modified: 2010-05-15 15:41:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 6632 - Timestamp with zone and PostgreSQL
Timestamp with zone and PostgreSQL
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
PC Linux
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2006-07-11 18:11 UTC by GBurri
Modified: 2010-05-15 15:41 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

adds postgresql time format definition (1.68 KB, patch)
2006-07-17 21:15 UTC, Robert Treat

Description GBurri 2006-07-11 18:11:55 UTC
The date fields are created with the 'timestamptz' type under PostgreSQL so the
time zone should be supported.
in this case, 'wfTimestamp' (GlobalFunctions.php) can receive a date like this
one : '2006-07-11 10:36:00+02'.

I propose to add these lines : 
function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
	$uts = 0;
	$da = array();
	if ($ts==0) {
	} elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d)
(\d\d):(\d\d):(\d\d)$/D",$ts,$da)) {
		# TS_DB
+	} elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d)
(\d\d):(\d\d):(\d\d)\+(\d\d)$/D",$ts,$da)) {
+		# TS_DBTZ
+		$uts=gmmktime((int)$da[4] + (int)$da[7],(int)$da[5],(int)$da[6],
+			    (int)$da[2],(int)$da[3],(int)$da[1]);
Comment 1 Robert Treat 2006-07-17 21:15:40 UTC
Created attachment 2117 [details]
adds postgresql time format definition
Comment 2 Robert Treat 2006-07-17 21:15:56 UTC
I'm not sure I fully understand the above. AFAICT the issue I have had with
postgresql is that the mediawiki software attempts to operate as if the db is
working in GMT, which throws off timestamps which may be at a different
timezone.  The attached patch implements a POSTGRES timestamp definition within
mediawiki, and adjusts it accordingly. This method worked well for wikipgedia. 
Comment 3 Domas Mituzas 2006-07-18 07:45:23 UTC
I think bigger error is to create date fields with timezone information. 
Initial PG support did use 'timestamp without timezone' everywhere. 
Comment 4 Greg Sabino Mullane 2007-03-26 01:07:13 UTC
Going to close this for now as resolved: if specific timestamp related errors
come up, please reopen of open a new bug.

Note You need to log in before you can comment on or make changes to this bug.