# lv_calendar.h (/api/widgets/calendar/lv_calendar_h)



<RelatedHeaders name="lv_calendar_private.h" isPrivate="false" />

<ApiSummary functions="16" structs="1" variables="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (9)&#x22;,&#x22;Getters (6)&#x22;,&#x22;Other (1)&#x22;]">
  <ApiTab value="Setters (9)">
    <ApiMember kind="function" name="lv_calendar_set_today_date" file="widgets/calendar/lv_calendar.h" line="65" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L65">
      lv_calendar_set_today_date [#lv_calendar_set_today_date]

      Set the today's year, month and day at once

      ```c title=" " lineNumbers=1
      void lv_calendar_set_today_date(lv_obj_t *obj, uint32_t year, uint32_t month, uint32_t day)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description                  |
      | ------- | ------------------------------------------------ | ---------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `year`  | <ApiLink name="uint32_t" />                      | today's year                 |
      | `month` | <ApiLink name="uint32_t" />                      | today's month \[1..12]       |
      | `day`   | <ApiLink name="uint32_t" />                      | today's day \[1..31]         |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_today_year" file="widgets/calendar/lv_calendar.h" line="72" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L72">
      lv_calendar_set_today_year [#lv_calendar_set_today_year]

      Set the today's year

      ```c title=" " lineNumbers=1
      void lv_calendar_set_today_year(lv_obj_t *obj, uint32_t year)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                  |
      | ------ | ------------------------------------------------ | ---------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `year` | <ApiLink name="uint32_t" />                      | today's year                 |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_today_month" file="widgets/calendar/lv_calendar.h" line="79" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L79">
      lv_calendar_set_today_month [#lv_calendar_set_today_month]

      Set the today's year

      ```c title=" " lineNumbers=1
      void lv_calendar_set_today_month(lv_obj_t *obj, uint32_t month)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description                  |
      | ------- | ------------------------------------------------ | ---------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `month` | <ApiLink name="uint32_t" />                      | today's month \[1..12]       |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_today_day" file="widgets/calendar/lv_calendar.h" line="86" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L86">
      lv_calendar_set_today_day [#lv_calendar_set_today_day]

      Set the today's year

      ```c title=" " lineNumbers=1
      void lv_calendar_set_today_day(lv_obj_t *obj, uint32_t day)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                  |
      | ----- | ------------------------------------------------ | ---------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `day` | <ApiLink name="uint32_t" />                      | today's day \[1..31]         |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_month_shown" file="widgets/calendar/lv_calendar.h" line="94" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L94">
      lv_calendar_set_month_shown [#lv_calendar_set_month_shown]

      Set the currently shown year and month at once

      ```c title=" " lineNumbers=1
      void lv_calendar_set_month_shown(lv_obj_t *obj, uint32_t year, uint32_t month)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description                  |
      | ------- | ------------------------------------------------ | ---------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `year`  | <ApiLink name="uint32_t" />                      | shown year                   |
      | `month` | <ApiLink name="uint32_t" />                      | shown month \[1..12]         |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_shown_year" file="widgets/calendar/lv_calendar.h" line="101" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L101">
      lv_calendar_set_shown_year [#lv_calendar_set_shown_year]

      Set the currently shown year

      ```c title=" " lineNumbers=1
      void lv_calendar_set_shown_year(lv_obj_t *obj, uint32_t year)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                  |
      | ------ | ------------------------------------------------ | ---------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `year` | <ApiLink name="uint32_t" />                      | shown year                   |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_shown_month" file="widgets/calendar/lv_calendar.h" line="108" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L108">
      lv_calendar_set_shown_month [#lv_calendar_set_shown_month]

      Set the currently shown month

      ```c title=" " lineNumbers=1
      void lv_calendar_set_shown_month(lv_obj_t *obj, uint32_t month)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description                  |
      | ------- | ------------------------------------------------ | ---------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object |
      | `month` | <ApiLink name="uint32_t" />                      | shown month \[1..12]         |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_highlighted_dates" file="widgets/calendar/lv_calendar.h" line="117" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L117">
      lv_calendar_set_highlighted_dates [#lv_calendar_set_highlighted_dates]

      Set the highlighted dates

      ```c title=" " lineNumbers=1
      void lv_calendar_set_highlighted_dates(lv_obj_t *obj, lv_calendar_date_t highlighted[], size_t date_num)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name          | Type                                             | Description                                                                                                                                                                   |
      | ------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`         | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object                                                                                                                                                  |
      | `highlighted` | <ApiLink name="lv_calendar_date_t" />            | pointer to an <ApiLink name="lv_calendar_date_t" /> array containing the dates. Only the pointer will be saved so this variable can't be local which will be destroyed later. |
      | `date_num`    | <ApiLink name="size_t" />                        | number of dates in the array                                                                                                                                                  |
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_set_day_names" file="widgets/calendar/lv_calendar.h" line="126" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L126">
      lv_calendar_set_day_names [#lv_calendar_set_day_names]

      Set the name of the days

      ```c title=" " lineNumbers=1
      void lv_calendar_set_day_names(lv_obj_t *obj, const char **day_names)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                             | Description                                                                                                                                                                         |
      | ----------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`       | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a calendar object                                                                                                                                                        |
      | `day_names` | `const char **`                                  | pointer to an array with the names. E.g. `const char * days[7] = {"Sun", "Mon", ...}` Only the pointer will be saved so this variable can't be local which will be destroyed later. |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (6)">
    <ApiMember kind="function" name="lv_calendar_get_btnmatrix" file="widgets/calendar/lv_calendar.h" line="138" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L138">
      lv_calendar_get_btnmatrix [#lv_calendar_get_btnmatrix]

      Get the button matrix object of the calendar. It shows the dates and day names.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description                  |
      | ----- | ------------------------------------------------------ | ---------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a calendar object |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to a the button matrix
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_get_today_date" file="widgets/calendar/lv_calendar.h" line="145" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L145">
      lv_calendar_get_today_date [#lv_calendar_get_today_date]

      Get the today's date

      ```c title=" " lineNumbers=1
      const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t *calendar)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                   | Description                  |
      | ---------- | ------------------------------------------------------ | ---------------------------- |
      | `calendar` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a calendar object |

      **Returns:** <ApiLink name="lv_calendar_date_t" display="const lv_calendar_date_t *" /> — return pointer to an <ApiLink name="lv_calendar_date_t" /> variable containing the date of today.
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_get_showed_date" file="widgets/calendar/lv_calendar.h" line="152" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L152">
      lv_calendar_get_showed_date [#lv_calendar_get_showed_date]

      Get the currently showed

      ```c title=" " lineNumbers=1
      const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t *calendar)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                   | Description                  |
      | ---------- | ------------------------------------------------------ | ---------------------------- |
      | `calendar` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a calendar object |

      **Returns:** <ApiLink name="lv_calendar_date_t" display="const lv_calendar_date_t *" /> — pointer to an <ApiLink name="lv_calendar_date_t" /> variable containing the date is being shown.
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_get_highlighted_dates" file="widgets/calendar/lv_calendar.h" line="159" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L159">
      lv_calendar_get_highlighted_dates [#lv_calendar_get_highlighted_dates]

      Get the highlighted dates

      ```c title=" " lineNumbers=1
      lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t *calendar)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                   | Description                  |
      | ---------- | ------------------------------------------------------ | ---------------------------- |
      | `calendar` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a calendar object |

      **Returns:** <ApiLink name="lv_calendar_date_t" display="lv_calendar_date_t *" /> — pointer to an <ApiLink name="lv_calendar_date_t" /> array containing the dates.
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_get_highlighted_dates_num" file="widgets/calendar/lv_calendar.h" line="166" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L166">
      lv_calendar_get_highlighted_dates_num [#lv_calendar_get_highlighted_dates_num]

      Get the number of the highlighted dates

      ```c title=" " lineNumbers=1
      size_t lv_calendar_get_highlighted_dates_num(const lv_obj_t *calendar)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                   | Description                  |
      | ---------- | ------------------------------------------------------ | ---------------------------- |
      | `calendar` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a calendar object |

      **Returns:** <ApiLink name="size_t" /> — number of highlighted days
    </ApiMember>

    <ApiMember kind="function" name="lv_calendar_get_pressed_date" file="widgets/calendar/lv_calendar.h" line="175" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L175">
      lv_calendar_get_pressed_date [#lv_calendar_get_pressed_date]

      Get the currently pressed day

      ```c title=" " lineNumbers=1
      lv_result_t lv_calendar_get_pressed_date(const lv_obj_t *calendar, lv_calendar_date_t *date)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                                 | Description                  |
      | ---------- | -------------------------------------------------------------------- | ---------------------------- |
      | `calendar` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" />               | pointer to a calendar object |
      | `date`     | <ApiLink name="lv_calendar_date_t" display="lv_calendar_date_t *" /> | store the pressed date here  |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: there is a valid pressed date LV\_RESULT\_INVALID: there is no pressed data
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (1)">
    <ApiMember kind="function" name="lv_calendar_create" file="widgets/calendar/lv_calendar.h" line="48" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L48">
      lv_calendar_create [#lv_calendar_create]

      Create a calendar widget

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_calendar_create(lv_obj_t *parent)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                             | Description                                                     |
      | -------- | ------------------------------------------------ | --------------------------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object, it will be the parent of the new calendar |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer the created calendar
    </ApiMember>
  </ApiTab>
</ApiTabs>

Structs [#structs]

<ApiMember kind="struct" name="lv_calendar_date_t">
  lv_calendar_date_t [#lv_calendar_date_t]

  Represents a date on the calendar object (platform-agnostic).

  | Member  | Type                        | Description |
  | ------- | --------------------------- | ----------- |
  | `year`  | <ApiLink name="uint16_t" /> |             |
  | `month` | <ApiLink name="uint8_t" />  | 1..12       |
  | `day`   | <ApiLink name="uint8_t" />  | 1..31       |
</ApiMember>

<TypeUsedBy name="lv_calendar_date_t" count="4">
  * `lv_calendar_set_highlighted_dates` — param `highlighted`
  * `lv_calendar_get_pressed_date` — param `date`
  * `lv_calendar_get_day_name` — param `gregorian`
  * `lv_calendar_gregorian_to_chinese` — param `gregorian_time`
</TypeUsedBy>

Variables [#variables]

<ApiMember kind="variable" name="lv_calendar_class" file="widgets/calendar/lv_calendar.h" line="37" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/calendar/lv_calendar.h#L37">
  lv_calendar_class [#lv_calendar_class]

  ```c title=" " lineNumbers=1
  const lv_obj_class_t lv_calendar_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_buttonmatrix.h&#x22;, &#x22;lv_calendar_header_arrow.h&#x22;, &#x22;lv_calendar_header_dropdown.h&#x22;, &#x22;lv_calendar_chinese.h&#x22;]" includedBy="[&#x22;lv_calendar_chinese.h&#x22;, &#x22;lv_calendar_private.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_display.h&#x22;, &#x22;lv_draw.h&#x22;, &#x22;lv_draw_arc.h&#x22;, &#x22;lv_draw_blur.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_draw_image.h&#x22;, &#x22;lv_draw_label.h&#x22;, &#x22;lv_draw_line.h&#x22;, &#x22;lv_draw_rect.h&#x22;, &#x22;lv_draw_triangle.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_group.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_indev.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_obj.h&#x22;, &#x22;lv_obj_class.h&#x22;, &#x22;lv_obj_draw.h&#x22;, &#x22;lv_obj_event.h&#x22;, &#x22;lv_obj_pos.h&#x22;, &#x22;lv_obj_property.h&#x22;, &#x22;lv_obj_property_names.h&#x22;, &#x22;lv_obj_scroll.h&#x22;, &#x22;lv_obj_style.h&#x22;, &#x22;lv_obj_style_gen.h&#x22;, &#x22;lv_obj_tree.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_style_properties.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
