DateSerial Function

Returns a Date value for a specified year, month, and day.

Syntax:


DateSerial(jaro, monato, tago)

Return value:

Dato

Parameters:

Year: Entjera esprimo kiu signifas jaron. Ĉiuj valoroj inter 0 kaj 99 interpretiĝas kiel jaroj 1900-1999. Por jaroj ekster tiu amplekso, necesas enmeti ĉiujn kvar signojn.

Month: Entjera esprimo kiu signifas la monaton de la specifita jaro. La akceptebla amplekso estas 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.

La funkcio DateSerial liveras la nombron da tagoj inter la 30a decembro 1899 kaj la donita dato. La funkcio estas uzebla por kalkuli la diferencon inter du datoj.

The DateSerial function 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 1900-01-01, the returned value is 2. Negative values correspond to dates before December 30, 1899 (not inclusive).

Se la cela dato troviĝas ekster la akceptebla amplekso, LibreOffice Basic liveras prieraran mesaĝon.

Kvankam oni difinas la funkcion DateValue kiel ĉenon kiu enhavas la daton, la funkcio DateValue kalkulas ĉiun parametron (jaron, monaton, tagon) kiel apartajn numerajn esprimojn.

Error codes:

5 Nevalida procedurvoko

Example:


  Sub ExampleDateSerial
  Dim lDate As Long
  Dim sDate As String
      lDate = DateSerial(1964, 4, 9)
      sDate = DateSerial(1964, 4, 9)
      msgbox lDate REM liveras 23476
      MsgBox sDate ' returns 1964-04-09 in ISO 8601 format
  End Sub

Bonvolu subteni nin!