Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

display in time in a normal format

I am placing time values into my excel sheet in vb6

The time that I have in my DB looks like the following:  DataType Time(7)

HourTimeFrom      HourTimeTo
13:00:00.0000000      14:00:00.0000000
09:00:00.0000000      10:00:00.0000000
09:00:00.0000000      10:00:00.0000000

I am using the following query

SELECT r.RegID,h.HourTimeFrom,h.HourTimeTo from tblOrgHours

I would like the output to return a standard time format or 1:00 PM
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

SELECT CONVERT(VARCHAR(10), HourTimeFrom, 100) AS HourTimeFrom,
   CONVERT(VARCHAR(10), HourTimeTo, 100) AS HourTimeTo
FROM tblOrgHours
Or in Excel format those columns with the "h:mm AM/PM" custom format. That might make it easier to perform calculations against those time values (instead of converting it into text).
Avatar of al4629740

ASKER

Russell,

I tried that route and it still shows up in the funky numbers
Using this method
SELECT CONVERT(VARCHAR(10), HourTimeFrom, 100) AS HourTimeFrom,
   CONVERT(VARCHAR(10), HourTimeTo, 100) AS HourTimeTo
FROM tblOrgHours

Does it take up much more processing time?  If so, is there a better way to do this?  

Is there a DataType that addresses this issue?
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial