Learn how to Make Money Online doing freelancing, Affiliate Marketing, Blogging and many more ...
Go4Expert
Go4Expert RSS Feed

Go Back   Programming and SEO Forum >  Go4Expert > Queries and Discussion > Database > SQL Server

Reply  Copy HTML to Clipboard  Copy BBCode to Clipboard  | More
 
Bookmarks Thread Tools Search this Thread Display Modes
Old 11-08-2004, 01:33 PM   #1
Team Leader
 
go4expert's Avatar
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
go4expert is on a distinguished road

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.
go4expert is offline   Reply With Quote
Old 11-08-2004, 02:35 PM   #2
Contributor
 
Amit Ray's Avatar
 
Join Date: Jul 2004
Posts: 75
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 7
Amit Ray is on a distinguished road
Send a message via Yahoo to Amit Ray
Thumbs up

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.
Amit Ray is offline   Reply With Quote
Old 11-09-2004, 08:19 AM   #3
Team Leader
 
go4expert's Avatar
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
go4expert is on a distinguished road

Re: Format Date in SQL Server


Quote:
MySQL Manual : Date and Time Functions

Formatting Dates in MySQL
Hey Amit I am looking for SQL Server stuff and not MySQL.
__________________
Why beat anybody with style when you can do it with content.
go4expert is offline   Reply With Quote
Old 11-09-2004, 08:26 AM   #4
Go4Expert Founder
 
shabbir's Avatar
 
Join Date: Jul 2004
Location: On Earth
Posts: 12,516
Thanks: 53
Thanked 276 Times in 215 Posts
Rep Power: 10
shabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud of
Send a message via Yahoo to shabbir

Re: Format Date in SQL Server


Quote:
Hey Amit I am looking for SQL Server stuff and not MySQL.
I guess he mis read the query

Quote:
I want to format the date of SQL server in the select statement but could not get it done.
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
shabbir is offline   Reply With Quote
Old 11-09-2004, 09:23 AM   #5
Contributor
 
Amit Ray's Avatar
 
Join Date: Jul 2004
Posts: 75
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 7
Amit Ray is on a distinguished road
Send a message via Yahoo to Amit Ray
Thumbs up

Re: Format Date in SQL Server


Amit Ray is offline   Reply With Quote
Old 11-10-2004, 03:09 PM   #6
Go4Expert Founder
 
shabbir's Avatar
 
Join Date: Jul 2004
Location: On Earth
Posts: 12,516
Thanks: 53
Thanked 276 Times in 215 Posts
Rep Power: 10
shabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud ofshabbir has much to be proud of
Send a message via Yahoo to shabbir

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
shabbir is offline   Reply With Quote
Old 11-10-2004, 03:12 PM   #7
Team Leader
 
go4expert's Avatar
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
go4expert is on a distinguished road

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.
go4expert is offline   Reply With Quote
Old 10-14-2007, 01:30 AM   #8
Light Poster
 
Join Date: Oct 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
darsh999 is an unknown quantity at this point

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 ?
__________________
Free Games
Bad Credit Repair
darsh999 is offline   Reply With Quote
Reply  Copy HTML to Clipboard  Copy BBCode to Clipboard  | More


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Bookmarks

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads / Articles
Thread Thread Starter Forum Replies Last Post
Getting Priviledges of user in Oracle/SQL Server go4expert Oracle 2 11-08-2004 01:28 PM

 

All times are GMT +5.5. The time now is 05:30 AM.