Change the date format displayed by the DateTime Field Templateshttp://forums.asp.net/t/1723744.aspx/1?Change+the+date+format+displayed+by+the+DateTime+Field+TemplatesFri, 23 Sep 2011 20:22:13 -040017237444611019http://forums.asp.net/p/1723744/4611019.aspx/1?Change+the+date+format+displayed+by+the+DateTime+Field+TemplatesChange the date format displayed by the DateTime Field Templates <p>I need to change the display date format of all the dates in my Dynamic Data app.&nbsp; I'm trying to modify the DateTime field template to always return in short date format (&quot;d&quot;).&nbsp; I don't need globalization or anything sophisticated.&nbsp; Changing the <strong>return Literal1</strong>&nbsp; to return Literal1.ToString(&quot;d&quot;) gives an error&quot;No overload for method 'ToString' takes 1 arguments&quot;.</p> <p>Thanks,</p> <p>Jim</p> 2011-09-23T18:03:19-04:004611029http://forums.asp.net/p/1723744/4611029.aspx/1?Re+Change+the+date+format+displayed+by+the+DateTime+Field+TemplatesRe: Change the date format displayed by the DateTime Field Templates <p>Because you are converting string into date. that why it is giving error</p> <p>you need to convert like</p> <p><strong>Convert.ToDateTime(literal1.Text).ToString(&quot;d&quot;)</strong></p> 2011-09-23T18:10:06-04:004611142http://forums.asp.net/p/1723744/4611142.aspx/1?Re+Change+the+date+format+displayed+by+the+DateTime+Field+TemplatesRe: Change the date format displayed by the DateTime Field Templates <p>You will need to do this in the OnDataBinding event of the field template and use the FiledValue property</p> <p>Literal1.Text = ((DateTime)FieldValue).ToString(&quot;d&quot;);</p> <p>Or you can do that using the [DataTypeAttabute on each DataTime field in the metadata.</p> <p>&nbsp;</p> 2011-09-23T20:22:13-04:00