PDA

View Full Version : Date Format EX:2011-03-10 04:04:04



Nagaraju
Mar 10, 2011, 7:47 AM
Hi,
I want to show date field in coolitegrid with this format [2011-03-10 04:04:04].
can any one help me.
i used render fn li dmy h:i:s but it's showing different format.
please help

Daniil
Mar 10, 2011, 11:05 PM
Hi,

"Y-m-d hh:m:s" - C# string date format (markup).
"Y-m-j h:m:s" - ExtJS string date format (JavaScript).

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { DateTime.Now },
new object[] { DateTime.Now.AddDays(1) },
};
store.DataBind();
}
}
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.Net Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="test" Type="Date" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:DateColumn
Header="Test"
DataIndex="test"
Format="Y-m-d hh:m:s"
Width="200" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</form>
</body>
</html>