Calendar for WinForms | ComponentOne
CalendarView / Behavior / Format
In This Topic
    Format
    In This Topic

    The CalendarView control supports date formats, such as CaptionFormat and TodayFormat. Both the formats are explained in detail with code snippets in the following sections:

    Caption Format

    The C1CalendarView class provides the CaptionFormat property to set a format for the calendar caption.

    The code snippet below shows how to set a caption format:

    C#
    Copy Code
    // Set format for caption of calendar
    calendarView.CaptionFormat = "M yyyy";
    

    Today Format

    CalendarView lets you to set a format to display the Today button according to your requirement. For this purpose, the C1CalendarView class provides the TodayFormat property.

    This property lets you add the text as well as date format. The date format is defined using the curly braces as shown in the code snippet.

    C#
    Copy Code
    // Set text for Today's button
    calendarView.TodayFormat = "&Today's date is: {dd MMM yyyy}";
    

    The resulting output will look like the image below: