Browse Source

int2phone function added

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@46 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
master
akulikov 16 years ago
parent
commit
80dc3db145
  1. 14
      classes/Format.class.php

14
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'));
Loading…
Cancel
Save