E evertVB Registered User. Local time Today, 03:42 Joined Sep 21, 2010 Messages 21 Jul 22, 2011 #1 How can I get Tomorrow 9:00:00 AM in a Date type? Following code will return exactly current time tomorrow: Code: Dim hDate As Date hDate = DateAdd("d", 1, Now()) But I want tomorrow 9:00:00 AM in hDate.
How can I get Tomorrow 9:00:00 AM in a Date type? Following code will return exactly current time tomorrow: Code: Dim hDate As Date hDate = DateAdd("d", 1, Now()) But I want tomorrow 9:00:00 AM in hDate.
E evertVB Registered User. Local time Today, 03:42 Joined Sep 21, 2010 Messages 21 Jul 22, 2011 #2 Maybe I've got it: Code: Function Tomorrow_9() As Date Dim hDate As Date Dim h9 As Date h9 = #9:00:00 AM# hDate = DateAdd("d", 1, Now()) hDate = CDate(Format(hDate, "dd/mm/yy")) Tomorrow_9 = DateAdd("h", 9, hDate) End Function
Maybe I've got it: Code: Function Tomorrow_9() As Date Dim hDate As Date Dim h9 As Date h9 = #9:00:00 AM# hDate = DateAdd("d", 1, Now()) hDate = CDate(Format(hDate, "dd/mm/yy")) Tomorrow_9 = DateAdd("h", 9, hDate) End Function
G Galaxiom Super Moderator Staff member Local time Today, 20:42 Joined Jan 20, 2009 Messages 12,895 Jul 22, 2011 #3 Here is a simpler expression: = Date() + 1.375