Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello,

DateSerial takes three arguments - Year month and day. These three arguments are separated by commas. When you state:

DateSerial(2018,01,03)

2018,01,03 is NOT a string but rather three numeric figures separated by commas. To get the results you want you need to extract the necessary data from today;

currMonth = Month(today)
currDay = Day(today)
currYear = Year(today)

Now you also must define the result wanted - defined as a string will return mm/dd/yy & defined as long will return nnnnn.

So for a serial number returned:

Sub Main
    Dim serialDate as Long
    today = ThisComponent.Drawpage.Forms.getByName("Form").getByName("dteDatePick").text
    currMonth = Month(today)
    currDay = Day(today)
    currYear = Year(today)
    serialDate = DateSerial( currYear, currMonth, currDay )
    MsgBox serialDate 
End Sub

Hello,

DateSerial takes three arguments - Year month and day. These three arguments are separated by commas. When you state:

DateSerial(2018,01,03)

2018,01,03 is NOT a string but rather three numeric figures separated by commas. To get the results you want you need to extract the necessary data from today;

currMonth = Month(today)
currDay = Day(today)
currYear = Year(today)

Now you also must define the result wanted - defined as a string will return mm/dd/yy & defined as long will return nnnnn.

So for a serial number returned:

Sub Main
    Dim serialDate as Long
    today = ThisComponent.Drawpage.Forms.getByName("Form").getByName("dteDatePick").text
    currMonth = Month(today)
    currDay = Day(today)
    currYear = Year(today)
    serialDate = DateSerial( currYear, currMonth, currDay )
    MsgBox serialDate 
End Sub

See also -> DateSerial Function [Runtime]