예제 #1
0
function form_format_date($defaut)
{
    $jour_l = jour_en_lettres(date('d'), date('m'), date('Y'));
    $mois_l = mois_en_lettres(date('m'));
    $formats = array('0' => date('d') . '/' . date('m') . '/' . date('Y'), '1' => date('m') . '/' . date('d') . '/' . date('Y'), '2' => date('d') . ' ' . $mois_l . ' ' . date('Y'), '3' => $jour_l . ' ' . date('d') . ' ' . $mois_l . ' ' . date('Y'), '4' => $mois_l . ' ' . date('d') . ', ' . date('Y'), '5' => $jour_l . ', ' . $mois_l . ' ' . date('d') . ', ' . date('Y'), '6' => date('Y') . '-' . date('m') . '-' . date('d'));
    $form = "\t" . '<label>' . $GLOBALS['lang']['pref_format_date'] . '</label>' . "\n";
    $form .= "\t" . '<select name="format_date">' . "\n";
    foreach ($formats as $option => $label) {
        $form .= "\t\t" . '<option value="' . htmlentities($option) . '"' . ($defaut == $option ? ' selected="selected" ' : '') . '>' . $label . '</option>' . "\n";
    }
    $form .= "\t" . '</select>' . "\n";
    return $form;
}
예제 #2
0
파일: conv.php 프로젝트: CamTosh/blogotext
function date_formate($id, $format_force = '')
{
    $retour = '';
    $date = decode_id($id);
    $time_article = mktime(0, 0, 0, $date['mois'], $date['jour'], $date['annee']);
    $auj = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
    $hier = mktime(0, 0, 0, date('m'), date('d') - '1', date('Y'));
    $jour_l = jour_en_lettres($date['jour'], $date['mois'], $date['annee']);
    $mois_l = mois_en_lettres($date['mois']);
    $format = array('0' => $date['jour'] . '/' . $date['mois'] . '/' . $date['annee'], '1' => $date['mois'] . '/' . $date['jour'] . '/' . $date['annee'], '2' => $date['jour'] . ' ' . $mois_l . ' ' . $date['annee'], '3' => $jour_l . ' ' . $date['jour'] . ' ' . $mois_l . ' ' . $date['annee'], '4' => $jour_l . ' ' . $date['jour'] . ' ' . $mois_l, '5' => $mois_l . ' ' . $date['jour'] . ', ' . $date['annee'], '6' => $jour_l . ', ' . $mois_l . ' ' . $date['jour'] . ', ' . $date['annee'], '7' => $date['annee'] . '-' . $date['mois'] . '-' . $date['jour'], '8' => substr($jour_l, 0, 3) . '. ' . $date['jour'] . ' ' . $mois_l);
    if ($format_force != '') {
        $retour = $format[$format_force];
    } else {
        $retour = $format[$GLOBALS['format_date']];
        if ($time_article == $auj) {
            $retour = $GLOBALS['lang']['aujourdhui'] . ', ' . $retour;
        } elseif ($time_article == $hier) {
            $retour = $GLOBALS['lang']['hier'] . ', ' . $retour;
        }
    }
    return ucfirst($retour);
}