Documentation on com/sun/star/awt/UnoControlDateFieldModel.html#Date
long Date;
Description
specifies the date displayed in the control.
The date must be specified in the format YYYYMMDD.
Binding a date control's change event to Basic MriLib.Module1.Mri I get:
Code: Select all
Sub Snippet(Optional oInitialTarget As Object)
Dim oSource As Variant
Dim oModel As Variant
oSource = oInitialTarget.Source
oModel = oSource.getModel()
End Sub
which shows all properties including this:
Date
long 20140214 Maybevoid,Bound,Maybedefault 95
The Basic documentation is unclear about the return type of cDateToIso, however ...
Code: Select all
print TypeName(cDateToISO(Now())), cDateToISO(Now())
.. .reports
20140227 string
This might work:
Code: Select all
oDateFieldModel.Date = cInt(CDateToIso( Date()))
Someone should update the wiki and the F1 help too.
Of course, all this silly Basic hacking would be obsolete if you would use a database able to use the current date as default values for a date field.