DateSerial Function

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

Syntax:


DateSerial (year, month, day)

Return value:

날짜

Parameters:

Year: 연도를 나타내는 정수 식입니다. 0에서 99 사이의 모든 값은 1900-1999년으로 해석됩니다. 이 범위를 벗어나는 연도의 경우 4자리 숫자를 모두 입력해야 합니다.

Month: 지정한 연도의 월을 나타내는 정수 식입니다. 허용되는 범위는 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.

DateSerial 함수는 1899년 12월 30일부터 지정한 날짜까지의 일 수를 구합니다. 이 함수를 사용하여 두 날짜의 차를 계산할 수 있습니다.

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).

허용되는 범위를 벗어나는 날짜를 지정할 경우 LibreOfficeDev Basic은 오류 메시지를 표시합니다.

DateValue 함수가 날짜를 포함하는 문자열로 지정되는 반면 DateSerial 함수는 연도, 월, 일 등과 같은 각 매개 변수를 별도의 숫자 식으로 평가합니다.

Error codes:

5 잘못된 프로시저 호출입니다.

Example:


  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 ' returns 1964-04-09 in ISO 8601 format
  End Sub