convert not working the way i want it to

I want to set up two columns in a timeclock report for the punch in and punch out times, that only show the times formatted as hh:mm:ss AM/PM, and not show the date portion. I tried using CONVERT() to convert the data in TimeClock.TimeIn and TimeClock.TimeOut into data type 108, which i think should be hh:mm:ss, but it is still showing up as the full date and time when i generate the report.

am i doing something wrong? can this be displayed this way?

thanks, kevin

Reply to
kskinne
Loading thread data ...

Kevin I'm just wondering why you would want to display it without a date. Logically wouldn't you want the date included as well to know exactly what dates someone worked. I believe it would be totally confusing to have times only with no way to associated a date.

Just wondering.

Reply to
Elizabeth

I already have a separate column to the left of the punchin and out columns that contains just the date - this is my first column and i use this to group total hours by day. the punch in and punch out times in column 2 and 3 are for the same day, what I want to do is just display those columns as the time of the day, without showing the date portion

kevin

"Elizabeth" wrote:

Reply to
kskinne

A DateTime value always includes a date. You're still converting to a DateTime Value - to get just the time, you have to use DATEPART

select top 10 TransactionNumber, CAST(DATEPART(hh, [Time]) as varchar) + ':'

  • CAST(DATEPART(mi, [Time]) as varchar) + ':' + CAST(DATEPART(ss, [Time]) as varchar) from [transaction]
Reply to
Glenn Adams [MVP - Retail Mgmt]

Glenn, thanks for the tip. That almost does what I need, however it returns the time in military instead of AM/PM, and it doesn't format it the best - for example, 3:15:04 PM shows up as 15:15:4, and ideally i'd like to show it as 3:15:04 PM, or in the very least 15:15:04

any way that this can be done?

thanks, kevin

Reply to
kskinne

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.