Google
 
Web itpro-blogger.blogspot.com
木曜日, 9月 06, 2007

[VBA]時刻の設定

▼質問
Date型の変数に時刻を設定するにはどうしたらいいの?

▼回答
Dim NowDate As Date
Dim MakeDate As Date
Dim strDate As String

NowDate = Now

strDate = Format(NowDate, "yyyy") & "/" & _
Format(NowDate, "mm") & "/" & _
Format(NowDate, "dd")
MakeDate = CDate(strDate)
MakeDate = DateTime.DateAdd("h", 24, MakeDate)

MsgBox Format(MakeDate, "yyyy/mm/dd hh:nn:ss")

MakeDate = DateTime.DateAdd("h", 1, MakeDate)

MsgBox Format(MakeDate, "yyyy/mm/dd hh:nn:ss")






Comments: コメントを投稿

<< Home

This page is powered by Blogger. Isn't yours?