function qtranxf_test_dt_format($cfg, $cfg_name = 'dtf', $format = 'F j, Y')
{
    global $q_config;
    $q_config['locale'] = array_merge(qtranxf_default_locale(), $q_config['locale']);
    $enabled_languages = $q_config['enabled_languages'];
    require_once QTRANSLATE_DIR . '/admin/qtx_admin_options_update.php';
    $t = strtotime('Nov 16, 2014 3:04pm');
    //qtranxf_dbg_log('qtranxf_test_dt_format: $t: ',$t);
    $m = PHP_EOL;
    foreach ($cfg as $c => $f) {
        if (!in_array($c, $q_config['enabled_languages'])) {
            $q_config['enabled_languages'][] = $c;
        }
        qtranxf_updateGettextDatabases(true, $c);
        $d = qtranxf_translate_dt_format($format, $c);
        //$d = qtranxf_convert_strftime2date($f);
        $sd = date($d, $t);
        $m .= '$' . $cfg_name . '[\'' . $c . '\'] = \'' . $d . '\';// "' . $sd . '"';
        if (false) {
            require_once QTRANSLATE_DIR . '/inc/qtx_date_time.php';
            $ff = qtranxf_convertDateFormatToStrftimeFormat($f);
            $sf = qtranxf_strftime($ff, $t);
            $m .= ' // strftime("' . $f . '") "' . ($sf ? $sf : 'invalid') . '"';
        }
        $m .= PHP_EOL;
    }
    $q_config['enabled_languages'] = $enabled_languages;
    //qtranxf_dbg_log('qtranxf_test_dt_format("'.$cfg_name.'","'.$format.'"): $m:'.$m);
    return $m;
}
function qtranxf_formatPostModifiedDateTime($format)
{
    global $post;
    return qtranxf_strftime(qtranxf_convertFormat($format, $format), mysql2date('U', $post->post_modified), '');
}
Example #3
0
function qtranxf_format_time($format, $mysq_time, $default, $before = '', $after = '')
{
    global $q_config;
    $ts = mysql2date('U', $mysq_time);
    if ($format == 'U') {
        return $ts;
    }
    $format = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($format);
    if (!empty($format) && $q_config['use_strftime'] == QTX_STRFTIME) {
        $format = qtranxf_convertDateFormatToStrftimeFormat($format);
    }
    return qtranxf_strftime(qtranxf_convertTimeFormat($format), $ts, $default, $before, $after);
}