Adding 2 datetime new formats: DATE_TIME_FORMAT_SHORT_TIME_FIRST (05:19 PM, Jan 10 2012 ) and DATE_TIME_FORMAT_SHORT (Jan 10 2012 at 05:19 PM)

skala
Julio Montoya 14 years ago
parent 0e8ccf0afa
commit f8dcdae2e5
  1. 6
      main/inc/lib/chat.lib.php
  2. 17
      main/inc/lib/internationalization.lib.php

@ -52,9 +52,9 @@ class Chat extends Model {
foreach ($_SESSION['openChatBoxes'] as $chatbox => $time) {
if (!isset($_SESSION['tsChatBoxes'][$chatbox])) {
$now = time() - strtotime($time);
$time = date('g:iA M dS', strtotime($time));
$message = get_lang('SentAt')." ".$time;
$time = api_convert_and_format_date($time, DATE_TIME_FORMAT_SHORT_TIME_FIRST);
$message = sprintf(get_lang('SentAtX'), $time);
if ($now > 180) {
$user_info = api_get_user_info($chatbox, true);
$item = array('s' => '2', 'f' => $chatbox, 'm' => $message, 'online' => $user_info['user_is_online'], 'username' => $user_info['complete_name']);

@ -31,6 +31,9 @@ define('DATE_TIME_FORMAT_LONG', 3); // August 25, 2009 at 03:28 PM
define('DATE_FORMAT_NUMBER', 4); // 25.08.09
define('DATE_TIME_FORMAT_LONG_24H', 5); // August 25, 2009 at 15:28
define('DATE_TIME_FORMAT_SHORT', 6); // Aug 25, 2009 at 03:28 PM
define('DATE_TIME_FORMAT_SHORT_TIME_FIRST', 7); // 03:28 PM, Aug 25 2009
// Formatting person's name.
define('PERSON_NAME_COMMON_CONVENTION', 0); // Formatting a person's name using the pattern as it has been
// configured in the internationalization database for every language.
@ -713,6 +716,20 @@ function api_format_date($time, $format = null, $language = null) {
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
}
break;
case DATE_TIME_FORMAT_SHORT:
$date_format = get_lang('dateTimeFormatShort', '', $language);
if (IS_PHP_53 && INTL_INSTALLED) {
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
}
break;
case DATE_TIME_FORMAT_SHORT_TIME_FIRST:
$date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language);
if (IS_PHP_53 && INTL_INSTALLED) {
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
}
break;
case DATE_TIME_FORMAT_LONG_24H:
$date_format = get_lang('dateTimeFormatLong24H', '', $language);

Loading…
Cancel
Save