From 80dc3db1450e47c8b4acdf6464bb37fa52072c7e Mon Sep 17 00:00:00 2001 From: akulikov Date: Tue, 20 Jan 2009 16:06:49 +0000 Subject: [PATCH] int2phone function added git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@46 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/Format.class.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/classes/Format.class.php b/classes/Format.class.php index 65c1d2b..c8c83cd 100644 --- a/classes/Format.class.php +++ b/classes/Format.class.php @@ -21,7 +21,7 @@ class Format /* Date & time */ static protected $time_format = 'H:i:s'; static protected $date_format = 'd.m.Y'; - static protected $date_time_format = 'd.m.Y H:i'; + static protected $date_time_format = 'H:i d.m.Y'; static protected $timezone_offset = 0; static protected $cache_time = array(); @@ -129,6 +129,18 @@ class Format } return self::$cache_time[$time]; } + + static public function int2phone($intphone) + { + $intphone = (string) $intphone; + + if (strlen($intphone) == 10) { + return '('.substr($intphone, 0, 3).') '.substr($intphone, 3, 3).'-'.substr($intphone, 6, 2).'-'.substr($intphone, 8, 2); + } elseif (strlen($intphone) == 7) { + return substr($intphone, 0, 3).'-'.substr($intphone, 3, 2).'-'.substr($intphone, 5, 2); + } + return ''; + } } Format::setTimezoneOffset(date('Z'));