Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting SysDate to show 12hour clock

Status
Not open for further replies.

SA812

Technical User
Jan 14, 2002
66
0
0
US
I'm trying to convert this system date to show me the hours and minutes in a 12 hour clock not the 24 hour format that it returns. Is there an easy way to convert to show 12 hour time? I've tried every type of casr nad convert format with no luck

CONVERT (nvarchar(20), LogBBT.SysDate, 8)
i ger :16:31:28

Thank in adavance for your help
 
i tried what was in the link:
CONVERT (VARCHAR(10), LogBBT.SysDate, 101) + RIGHT (CONVERT (VARCHAR(20), LogBBT.SysDate, 100), 8)
Result: 03/24/2009 4:31PM

I just want to isolate the Hours & Minutes i do not want the date "3/24/2009"

Thanks,
 
Do you want hours and minutes ONLY? Or do you want Hours, Minutes, and Seconds?

If you don't care about seconds....

Code:
Select Right(Convert(VarChar(100), LogBBT.SysDate, 100), 7)

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thanks George!!!
RIGHT (CONVERT (VarChar(100), LogBBT.SysDate, 100), 7)
Result: 4:31PM
worked perfectly!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top