PDA

View Full Version : [CLOSED] {addtime:date('Y-m-d')} not correct



hdsoso
Jul 01, 2014, 1:31 AM
in database
http://forums.ext.net/attachment.php?attachmentid=13171&stc=1
in model


public partial class QizArticle{
...
public System.DateTime addtime { get; set; }
}

in page


<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
...
<ext:ModelField Name="addtime"></ext:ModelField>
</ext:Model>
...
<Tpl ID="Tpl1" runat="server">
<Html>
<tpl for=".">
<li><span class="hdsoso_col">【<a href="qiz_col.aspx?cid={colid}">{colname}</a>】</span><span class="data">{addtime:date('Y-m-d')}</span><a class="infolist" title="{title}" href="qiz_art.aspx?aid={id}" target="_blank">{title}</a></li>
</tpl>
</Html>
</Tpl>


show on page :
http://forums.ext.net/attachment.php?attachmentid=13181&stc=1

IS IT a bug?

Daniil
Jul 01, 2014, 2:14 PM
Hi @hdsoso,

The Tpl's Html is rendered to client without any modifications.

So, 'Y-m-d' appears on client as it is. But it is a C# date format string.

On client you should use an ExtJS date format string.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Date