I want to format the date of SQL server in the select statement but could not get it done.
What I want is something like TO_DATE, TO_CHAR in Oracle.
![]() |
|
|
#1 |
|
Team Leader
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 ![]() |
Format Date in SQL Server
I want to format the date of SQL server in the select statement but could not get it done. What I want is something like TO_DATE, TO_CHAR in Oracle.
__________________
Why beat anybody with style when you can do it with content. |
|
|
|
|
|
#2 |
|
Contributor
|
Re: Format Date in SQL Server
Hello, Check out the following links .... MySQL Manual : Date and Time Functions Formatting Dates in MySQL Hope these will help ... Cheers, Amit Ray. |
|
|
|
|
|
#3 | |
|
Team Leader
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 ![]() |
Re: Format Date in SQL ServerQuote:
__________________
Why beat anybody with style when you can do it with content. |
|
|
|
|
|
|
#4 | ||
|
Go4Expert Founder
![]() |
Re: Format Date in SQL ServerQuote:
Quote:
Here is an example of how to use it. Code:
SELECT convert(varchar,getdate()) FROM <tablename> First parameter is the output data type wanted and second is the Field Name you want to format. Here I have used the current system date. Thanks Shabbir Bhimani |
||
|
|
|
|
|
#5 |
|
Contributor
|
Re: Format Date in SQL Server
Oops sorry .... for the various options with dates in SQL server you can look at the following links : http://www.sqlteam.com/item.asp?ItemID=240 http://www.databasejournal.com/featu...0894_2197931_2 http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=41292 http://expertanswercenter.techtarget...980070,00.html http://expertanswercenter.techtarget...980072,00.html Cheers, Amit Ray. |
|
|
|
|
|
#6 |
|
Go4Expert Founder
![]() |
Re: Format Date in SQL Server
Hey I just found this new thing with convert. It takes a 3rd parameter where the output of date can be as in desired fashion. http://msdn.microsoft.com/library/de...ca-co_2f3o.asp Thanks Shabbir Bhimani |
|
|
|
|
|
#7 |
|
Team Leader
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 ![]() |
Re: Format Date in SQL Server
Hey Guys. Thanks for all the help and convert really worked the way I wanted.
__________________
Why beat anybody with style when you can do it with content. |
|
|
|
|
|
#8 |
|
Light Poster
Join Date: Oct 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 ![]() |
Re: Format Date in SQL Server
I think we have a option of change/remove the date over there in server ! Have u tried that ? |
|
|
|
![]() |
|
More
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| Bookmarks | |
|
|
|
|
||||||||||||||||