עזרה עבור LibreOffice 24.8
Returns a Date value for a specified year, month, and day.
DateSerial (year, month, day)
Date
\<emph\>Year:\</emph\> Integer expression that indicates a year. All values between 0 and 99 are interpreted as the years 1900-1999. For years that fall outside this range, you must enter all four digits.
\<emph\>Month:\</emph\> Integer expression that indicates the month of the specified year. The accepted range is from 1-12.
Day: Integer expression that indicates the day of the specified month. The accepted range is from 1-31. No error is returned when you enter a non-existing day for a month shorter than 31 days.
The \<emph\>DateSerial function\</emph\> returns the number of days between December 30,1899 and the given date. You can use this function to calculate the difference between two dates.
The \<emph\>DateSerial function\</emph\> returns the data type Variant with VarType 7 (Date). Internally, this value is stored as a Double value, so that when the given date is 1.1.1900, the returned value is 2. Negative values correspond to dates before December 30, 1899 (not inclusive).
If a date is defined that lies outside of the accepted range, LibreOffice Basic returns an error message.
Whereas you define the \<emph\>DateValue function\</emph\> as a string that contains the date, the \<emph\>DateSerial function\</emph\> evaluates each of the parameters (year, month, day) as separate numeric expressions.
Sub ExampleDateSerial
Dim lDate As Long
Dim sDate As String
lDate = DateSerial(1964, 4, 9)
sDate = DateSerial(1964, 4, 9)
msgbox lDate REM returns 23476
msgbox sDate REM returns 04/09/1964
End Sub