return false;
}
- # Return DB-style timestamp used for MySQL schema
function timestamp( $ts=0 ) {
- return wfTimestamp(TS_DB,$ts);
+ return wfTimestamp(TS_POSTGRES,$ts);
}
/**
*/
define('TS_ORACLE', 6);
+/**
+ * Postgres format time.
+ */
+define('TS_POSTGRES', 7);
+
/**
* @param mixed $outputtype A timestamp in one of the supported formats, the
* function will autodetect which format is supplied
# TS_ISO_8601
$uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
(int)$da[2],(int)$da[3],(int)$da[1]);
+ } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/",$ts,$da)) {
+ # TS_POSTGRES
+ $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
+ (int)$da[2],(int)$da[3],(int)$da[1]);
} else {
# Bogus value; fall back to the epoch...
wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");
return gmdate( 'D, d M Y H:i:s', $uts ) . ' GMT';
case TS_ORACLE:
return gmdate( 'd-M-y h.i.s A', $uts) . ' +00:00';
+ case TS_POSTGRES:
+ return gmdate( 'Y-m-d H:i:s', $uts) . ' GMT';
default:
throw new MWException( 'wfTimestamp() called with illegal output type.');
}