Vba-cdate-function

提供:Dev Guides
移動先:案内検索

VBA-CDate関数

この関数は、有効な日付と時刻の式を日付型に変換します。

構文

cdate(date)

ボタンを追加し、次の関数を追加します。

Private Sub Constant_demo_Click()
   Dim a as Variant
   Dim b as Variant

   a = cdate("Jan 01 2020")
   msgbox("The Value of a : " & a)

   b = cdate("31 Dec 2050")
   msgbox("The Value of b : " & b)
End Sub

関数を実行すると、次の出力が生成されます。

The Value of a : 1/01/2020
The Value of b : 31/12/2050