【问题标题】:SmartGWT - Display date in yyyy/MM/dd formatSmartGWT - 以 yyyy/MM/dd 格式显示日期
【发布时间】:2011-01-21 20:01:32
【问题描述】:

我希望可以显示日期,并可以手动输入日期。 为此,我将属性 useTextField 设置为 true,例如:

setAttribute("useTextField", true);

现在我希望日期格式为 yyyy/MM/dd。

我试过了

setAttribute("displayFormat ", "TOJAPANSHORTDATE");
setAttribute("inputFormat ", "YMD");

但什么也没发生。

我需要使用属性。 我应该使用什么属性?又有什么价值呢?

请,需要帮助。 非常感谢。

【问题讨论】:

    标签: date smartgwt


    【解决方案1】:

    你可以试试

    .setDisplayFormat(DateDisplayFormat.TOJAPANSHORTDATE);
    

    【讨论】:

    • 我已经用date.setAttribute("useTextField", true); date.setAttribute("inputFormat", "yyyy/MM/dd"); date.setAttribute("displayFormat", "toJapanShortDate");stackoverflow.com/questions/5009896/…解决了这个问题
    • 日期选择器不会在文本字段中显示日期,而是今天的日期。例如,在文本字段中输入 30/05/2009,转到另一个字段,然后返回单击日期选择器,所选日期将是今天的日期,而不是 2009 年 6 月 30 日。如何解决?谢谢!
    • 我删除了date.setAttribute("inputFormat", "yyyy/MM/dd"); 并且工作正常。实际上date.setAttribute("displayFormat", "toJapanShortDate"); 给出了日期的格式。 "TOJAPANSHORTDATE 格式为 YYYY/MM/DD 的短日期。例如:2005/11/4" 来自here
    猜你喜欢
    • 1970-01-01
    • 2016-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多