|
Posted by CK on 06/07/06 22:44
"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns97DBEF917A66FYazorman@127.0.0.1...
> CK (c_kettenbach@hotmail.com) writes:
>> Currently the query returns 2006-03-27 00:00:00, can I make it output
>> 03/27/2006, I want to truncate the time, and replace the hyphens with
>> forward slashes. Any ideas?
>
> To add to David's reply, if you are using Query Analyzer for output,
> you can change how dates are formatted under Tools->Options->Connections.
> Check "Use Regional Settings...".
>
> You can also do it in an SQL query, look up CASE and CONVERT in Books
> Online. But this is a really poor alternative. Date formatting should
> be handled by the client, so that the user's regional settings can be
> respected.
>
I used , Convert(varchar(25), L.FromDate, 101) AS FromDate in the View and
then CAST(FromDate AS DateTime)>= '03/27/2004' in the query. This is an
internal application but I see why it should be done in code. Thanks!
[Back to original message]
|