[AccessD] SQL Server Date Time

Gustav Brock gustav at cactus.dk
Sun Jul 25 16:18:22 CDT 2010


Hi Chester

This should do:

datRoundedHour = DateSerial(Year(d), Month(d), Day(d)) + TimeSerial(Hour(d), Int((Minute(d) + 30) / 60) * 60, 0)

/gustav

>>> Chester_Kaup at kindermorgan.com 19-07-2010 18:24 >>>
I have a database linked to an SQL server table that has a date time column. I want only the date and the hour portion rounded to the nearest hour. For example

7/18/2010 1:41:00 AM becomes 7/18/2010 2:00:00 AM

Thanks 

Chester Kaup
Engineering Technician
Kinder Morgan CO2 Company, LLP
Office (432) 688-3797
FAX (432) 688-3799






More information about the AccessD mailing list