+ if ( function_exists( "date_create" ) ) {
+ if ( count( $da ) ) {
+ $ds = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.00+00:00",
+ (int)$da[1], (int)$da[2], (int)$da[3],
+ (int)$da[4], (int)$da[5], (int)$da[6]);
+
+ $d = date_create( $ds, new DateTimeZone( 'GMT' ) );
+ } elseif ( $strtime ) {
+ $d = date_create( $strtime, new DateTimeZone( 'GMT' ) );
+ } else {
+ return false;
+ }
+
+ if ( !$d ) {
+ wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");
+ return false;
+ }
+
+ $output = $d->format( $formats[$outputtype] );
+ } else {
+ if ( count( $da ) ) {
+ // Warning! gmmktime() acts oddly if the month or day is set to 0
+ // We may want to handle that explicitly at some point
+ $uts = gmmktime( (int)$da[4], (int)$da[5], (int)$da[6],
+ (int)$da[2], (int)$da[3], (int)$da[1] );
+ } elseif ( $strtime ) {
+ $uts = strtotime( $strtime );
+ }
+
+ if ( $uts === false ) {
+ wfDebug("wfTimestamp() can't parse the timestamp (non 32-bit time? Update php): $outputtype; $ts\n");
+ return false;
+ }
+
+ if ( TS_UNIX == $outputtype ) {