ASP.NET Calendar - Tutorial - Date and time format

Formatted date:
    Select date


DateFormat="M/d/yyyy"

Change culture to see date format:

 

Or set your own:

By default, date format is taken from current regional settings or from your defined culture.

You can set your own date format by using DateFormat property.

The following masks can be used:

Day:

  • d - Day of month without a leading zero (e.g. 2 or 23)
  • dd - Day of month with a leading zero (e.g. 02 or 23)
  • ddd - Abbreviated week day name (e.g. Tue)
  • dddd - Full week day name (e.g. Tuesday)

Month:

  • M - Month without a leading zero (e.g. 4 or 12)
  • MM - Month with a leading zero (e.g. 04 or 12)
  • MMM - Abbreviated month name (e.g. Jan)
  • MMMM - Full month name (e.g. January)

Year:

  • y - Year without the century. No leading zero if value is less than 10 (e.g. 6)
  • yy - Year without the century with leading zero (e.g. 06)
  • yyyy - Full 4-digit year (e.g. 2006)

Hour:

  • h - Hour without a leading zero (e.g. 6 or 11)
  • hh - Hour with a leading zero (e.g. 06 or 11)

Minute:

  • m - Minute without a leading zero (e.g. 2 or 35)
  • mm - Minute with a leading zero (e.g. 02 or 35)

Second:

  • s - Second without a leading zero (e.g. 9 or 59)
  • ss - Second with a leading zero (e.g. 09 or 59)

All of the above combinations will be replaced when encountered.
To not convert a format string, enclose it within single quotes:

'ddd' will not be converted, but day without quotes will become 23a6 for June 23, 2006,
so it should be enclosed within single quotes.