如何设置由 php 创建的日期样式并在单个 span 元素中输出


How can I style a date created by php and output within a single span element

我的问题是我正在使用的CMS在单个span元素中输出日期,如下所示:M/d/Y,它输出以下html:Mar/03/14。

我想设置每个变量堆叠的日期样式 例如 2014 年(底部)、1 月(年度顶部)和 14 日(月顶部的日期)。

不幸的是,我只能访问css和smarty tpl文件,而不能访问php文件。我正在寻找CSS解决方案,但我也对JS持开放态度。

任何建议不胜感激。

我用jQuery写了这个例子:

$(document).ready(function(){
    // You can change for your classes or add this in your smarty template
    var month = $('.month'),
        day = $('.day'),
        year = $('.year'),
        out = $('.out');
    var months = {
        'JAN': '01'
        'FEB', '02',
        'MAR': '03' 
        // etc...
    };
    // Hides the unecessary elements
    month.hide();
    year.hide();
    day.hide();
    out.html(months[month.text()] + '/' + day.text() + '/' + year.text());
});