Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need to create a column with the time portion of a datetime field. I'm using CONVERT(char(10),startdt,108)and I get15:00:00but what I want is3:00 PMI can't find the correct style. Can anyone help?
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2010-02-23 : 19:03:54
[code]select right(convert(varchar(20), startdt, 100), 7)[/code]KH[spoiler]Time is always against us[/spoiler]
projecttoday
Starting Member
31 Posts
Posted - 2010-02-23 : 20:51:50
Thanks. Is there any way to put a space between the time and the PM?
quote:Originally posted by projecttoday I need to create a column with the time portion of a datetime field. I'm using CONVERT(char(10),startdt,108)and I get15:00:00but what I want is3:00 PMI can't find the correct style. Can anyone help?
If you use front end application, do the formation thereMadhivananFailing to plan is Planning to fail
The Stuff is working. Thank you. This is for a listbox in Access. You've got a row source and a column width. No way to format it except in the SELECT. (?) Would be nice since the stuff/convert is a bit complicated. But I don't think there is any other way.