Wednesday, February 29, 2012

mvc format databound datetime column

if you want something like "22/11/2012 15:00" then use
columns.Bound(o => o.MyDateTimeValue).Format("{0:dd/MM/yyyy HH:mm}").Width(120);

if you want something like "22/11/2012 3:00 PM" then use
columns.Bound(o => o.MyDateTimeValue).Format("{0:dd/MM/yyyy hh:mm tt}").Width(120);

No comments: