How to insert the date into a date field in a dialog

I want to display today's date in a date field in a dialog. So before
displaying the dialog I have code like (3 different ways of trying to do
it):

Can some kind soul please tell me what I'm doing wrong? And how to do it
right?

Hello Peter,

could be something like this:

DIM unoDate
unoDate = createUnoStruct("com.sun.star.util.Date")
unoDate.Year = Year(Date)
unoDate.Month = Month(Date)
unoDate.Day = Day(Date)

unoDate is now the date, which should be put into the field:
oDateControl.Date = unoDate

Haven't tested this before for Dialogs, but the start with unoDate
works for forms.

Regards

Robert
- --
Homepage: http://robert.familiegrosskopf.de
LibreOffice Community: http://robert.familiegrosskopf.de/map_3

Thanks Robert.

That works fine. Someone else on the LO Ask platform also suggested

which also seems to work OK. (I don't think you need the View - it seems to
work either way).