Monday, December 08, 2008

Format data in gridview

To format the date and time, use DataFormatString="{0:MM/dd/yyyy hh:mm tt}"

d = day of month without leading zero
M = month without leading zero
yyyy = year as four digits
h = hours in 12 hour format without leading zero
mm = minutes with leading zero
tt = two character am/pm designaror

To format the "%", use DataFormatString="{0:0%}"

To format the currency "$xx.xx", use DataFormatString="{0:C}"

No comments: