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.
Hello, Check out the following links .... MySQL Manual : Date and Time Functions Formatting Dates in MySQL Hope these will help ... Cheers, Amit Ray.
I guess he mis read the query Hey you can use the convert function in SQL Server to achieve what you want. Here is an example of how to use it. Code: SELECT convert(varchar,getdate()) FROM <tablename> will show the output of current date in varchar format. 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
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/features/mssql/article.php/10894_2197931_2 http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=41292 http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci980070,00.html http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci980072,00.html Cheers, Amit Ray.
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/default.asp?url=/library/en-us/tsqlref/ts_ca-co_2f3o.asp Thanks Shabbir Bhimani