Formats a date variable according to the specified format. Simply uses the DateTime.ToString() method with the specified format.

Optional parameters:

First - the format used to output the date. Default is 'MMM dd, yyyy'.
Second - the value to use when the input is null.

ViewData["date"] = new DateTime(2000,10,6);

{$date|date_format:'dd MMM yyyy'}
{null|date_format:'dd/MMM/yyyy':'12 Jan 2009'}

Will output:

16 Oct 2000
12 Jan 2009

Last edited Feb 16, 2010 at 12:42 PM by JacoPretorius, version 3


No comments yet.