summaryrefslogtreecommitdiffstats
path: root/lib/l10n.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/l10n.php')
-rw-r--r--lib/l10n.php11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/l10n.php b/lib/l10n.php
index 4e65af66c4f..5271bd4e589 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -146,16 +146,11 @@ class OC_L10N{
// If you add something don't forget to add it to $localizations
// at the top of the page
case 'date':
- if( is_string( $data )) $data = strtotime( $data );
- return date( $this->localizations['date'], $data );
- break;
case 'datetime':
- if( is_string( $data )) $data = strtotime( $data );
- return date( $this->localizations['datetime'], $data );
- break;
case 'time':
- if( is_string( $data )) $data = strtotime( $data );
- return date( $this->localizations['time'], $data );
+ if( $data instanceof DateTime ) return $data->format($this->localizations[$type]);
+ elseif( is_string( $data )) $data = strtotime( $data );
+ return date( $this->localizations[$type], $data );
break;
default:
return false;