Thread: Rounding Time
View Single Post
  #13  
Old May 19th, 2010, 08:46 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default Rounding Time

Yes, DateValue returns ONLY the date portion of the string as a DateTime
value. TimeValue returns 0NLY the Time portion of the string.

If you want to convert the entire string and have both the date and time
values use CDate to the do the conversion.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Bre-x wrote:
Hi,

Public Sub temp()
Dim the_value As Date
the_value = DateValue("05/18/2010 8:16:01")
MsgBox RoundTime(the_value, 15, True)
End Sub

The msgbox shows "05/18/2010"
It should show "05/18/2010 8:30"

I must be missing something here!!!



"John W. Vinson" wrote in message
...
On Tue, 18 May 2010 14:00:18 -0600, "Bre-x" wrote:

Hi, Thank you for answering my post

the RoundTime function is not working or I dont know how to use it

Dim the_value As Date
the_value = "05/18/2010 8:15:01"
msgbox RoundTime(the_value, 15, True)

this should show 8:30

Rigth?

You're passing it a text string. It's expecting a Date/Time value. Try

the_value = DateValue("05/18/2010 8:15:01")

If it doesn't work (it did for me...) post back with more details. What
happened? No result, wrong result, flames coming out of your monitor?

--

John W. Vinson [MVP]