364,111 Members | 2013 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

how convert date to string

sourabhmca
P: 12
hi friend ,
I took joindate field in table as smalldatetime type now I want to convert it in String type and formate is dd/mm/yyyy .how to convert it . and again i want to change this String type to date type .how can i do it
Apr 12 '07 #1
Share this Question
Share on Google+
2 Replies


iburyak
Expert 100+
P: 1,017
It depends on your server settings how datetime understood. Only string data representation can be changed.
You can talk to your DBA to change datetime settings.

Did you see my respond on VB forum to your same question?

I don't understand why you don’t won't to do proper conversion that is recommended to use in these cases.


Good Luck.
Apr 12 '07 #2

iburyak
Expert 100+
P: 1,017
hi friend ,
I took joindate field in table as smalldatetime type now I want to convert it in String type and formate is dd/mm/yyyy .how to convert it . and again i want to change this String type to date type .how can i do it

Wait, I maybe misunderstood your question.
Do you want to convert string to datetime or datetime to string?

To convert datetime to string do following.

[PHP]select convert(varchar(20), getdate(), 103)[/PHP]

To convert String to Datetime with Server available format

[PHP]select convert(smalldatetime, '12/04/2007')[/PHP]

Good Luck.
Apr 12 '07 #3

Post your reply

Help answer this question



Didn't find the answer to your Microsoft SQL Server question?

You can also browse similar questions: Microsoft SQL Server tostring sqlserver