From 027cf020b77ebcbbc5933c4611e001eff37cfdd1 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 23 Feb 2009 19:50:16 +0000 Subject: [PATCH] ENHANCEMENT #3232 lenix: Added Date::FormatI18N() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@72119 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/fieldtypes/Date.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/model/fieldtypes/Date.php b/core/model/fieldtypes/Date.php index 41be21283..32b98922f 100644 --- a/core/model/fieldtypes/Date.php +++ b/core/model/fieldtypes/Date.php @@ -70,6 +70,16 @@ class Date extends DBField { if($this->value) return date($formattingString, strtotime($this->value)); } + /** + * Return the date formatted using the given strftime formatting string. + * + * strftime obeyes the current LC_TIME/LC_ALL when printing lexical values + * like day- and month-names + */ + function FormatI18N($formattingString) { + if($this->value) return strftime($formattingString, strtotime($this->value)); + } + /* * Return a string in the form "12 - 16 Sept" or "12 Aug - 16 Sept" */