Sorry if this has been asked befor, but I couldn't find anything that hepled me.
I have a datetime field and want to extract only the time. I know it works with CONVERT and style-type 108. But I get something like this: 08:00:00 and I need something like this: 08:00.
Originally posted by MAK select left(convert(varchar(10),getdate(),108),5)
Great! Thanks a lot. I have one other problem, maybee you can help me here too:
Depending on what version (German, English etc) of MS SQL Serve you are using it needs other formats when you want to put a date AND time into a datetime column.
Is there a universal format that every MS SQL Server accepts?
I have a similar issue but am new to this so please go easy.
I have a db datetime field. With a stored proc using a view I want to convert the datetime to be just the date, no time returned at all.
I have the date field in the view but an not sure of the syntax.
here is the date in the table; 2003-02-04 00:00:00.000.
Here is the part of the View that I need the conversion to work in (updated with your suggestion)...convert(varchar(10), dbo.[Order].manual_promise_date,110) AS ManualPromiseDate.
And this is what gets sent back...2003-02-04T00:00:00.0000000-05:00 when I want just 2003-02-04.
convert(varchar(10), dbo.[Order].manual_promise_date,110) AS ManualPromiseDate
any ideas or articles. Must be something I'm not getting. I even tried to change the 110 to something else but I keep getting the date in the following format.
It works in query analyizer but when I put that syntax into the view I get an error near the word Select. I am already doing a distinct select so I dropped the select.
Should I handle the select differently?
I will attach the complete view.