Date Field

From Apache OpenOffice Wiki
Jump to: navigation, search



The date field control com.sun.star.awt.UnoControlDateField extends the text field control and is used for displaying and entering dates. The date displayed in the date field is controlled by the Date property. The date value is of type Long and must be specified in the format YYYYMMDD, for example, the date September 30th, 2020 is set in the following format:

  oDateFieldModel = oDialog.Model.DateField1
  oDateFieldModel.Date = 20200930

The current date is set by using the Date and CDateToIso runtime functions:

  oDateFieldModel.Date = CDateToIso( Date() )

The minimum and the maximum date that the user can enter is defined by the DateMin and the DateMax property. The format of the displayed date is specified by the DateFormat and the DateShowCentury property, but the usage of DateShowCentury is deprecated. Some formats are dependent on the system settings. If the StrictFormat property is set to True, the date entered by the user is checked during input. The Dropdown property enables a calendar that the user can drop down to select a date.

Dropdown is currently not working by program, but you can set it with the Control Properties in the IDE.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages