Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
prettydate.php
1<?php
9
14
15Loc::loadMessages(__FILE__);
16
22{
28 public static function getDateTimeFormat()
29 {
30 $isAmPm = IsAmPmMode(true);
31 switch ($isAmPm)
32 {
33 case AM_PM_LOWER:
34 return Loc::getMessage('SENDER_PRETTY_DATE_FORMAT_DATETIME_PM_LOWER');
35
36 case AM_PM_UPPER:
37 return Loc::getMessage('SENDER_PRETTY_DATE_FORMAT_DATETIME_PM_UPPER');
38 }
39
40 return Loc::getMessage('SENDER_PRETTY_DATE_FORMAT_DATETIME');
41 }
42
48 public static function getDateFormat()
49 {
50 return Loc::getMessage('SENDER_PRETTY_DATE_FORMAT_DATE');
51 }
52
59 public static function formatDateTime(DateTime $date = null)
60 {
61 $date = $date ?: new DateTime();
62 return \FormatDate(self::getDateTimeFormat(), MakeTimeStamp($date));
63 }
64
71 public static function formatDate(Date $date = null)
72 {
73 $date = $date ?: new Date();
74 return \FormatDate(self::getDateFormat(), DateTime::createFromTimestamp(MakeTimeStamp($date)));
75 }
76}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static createFromTimestamp($timestamp)
Definition datetime.php:246
static formatDate(Date $date=null)
static formatDateTime(DateTime $date=null)