How can u convert the Date to String?

Answers were Sorted based on User's Feedback



How can u convert the Date to String?..

Answer / rajesh ranjan

select cast(getdate() as varchar)

select convert(varchar,getdate(),101)-mm/dd/yyyy
select convert(varchar,getdate(),102)-yy.mm.dd
select convert(varchar,getdate(),106)-ddmmyy
select convert(varchar,getdate(),108)-hh:mm:ss

etc.

Is This Answer Correct ?    18 Yes 2 No

How can u convert the Date to String?..

Answer / prasad

select convert(varchar,columnname,101) from tablename

Is This Answer Correct ?    11 Yes 2 No

How can u convert the Date to String?..

Answer / anil singh

iN PL/SQL WE USE TO_CHAR FUNCTION
SELECT TO_CHAR(SYSDATE,'MI','HH:MM:SS' FROM TABLE NAME

Is This Answer Correct ?    4 Yes 2 No

How can u convert the Date to String?..

Answer / samba shiva reddy . m

SELECT
GETDATE() AS UnconvertedDateTime,
CAST(GETDATE() AS nvarchar(30)) AS UsingCast,
CONVERT(nvarchar(30), GETDATE(), 126) AS UsingConvertTo_ISO8601 ;
GO
this will work for u try it out.

Is This Answer Correct ?    2 Yes 1 No

How can u convert the Date to String?..

Answer / sivakumar

Select convert(varchar(20),getdate()) As Date

Is This Answer Correct ?    5 Yes 5 No

How can u convert the Date to String?..

Answer / deepak rohilla

select convert(varchar(20),getdate())

Is This Answer Correct ?    5 Yes 9 No

Post New Answer

More SQL Server Interview Questions

What do you understand by mirroring?

0 Answers  


How does clustered and non clustered index work?

0 Answers  


What is the meaning of resultset type_scroll_insensitive?

0 Answers  


What does top operator do?

0 Answers  


How to make remote connection in database?

0 Answers  






What is a domain constraint give an example?

0 Answers  


What is tabulation?

0 Answers  


Can you tell me some of the common replication dmv's and their use? : sql server replication

0 Answers  


What is the difference between a clustered index and a non-clustered index?

0 Answers  


What does man by sql wildcard characters in sql server?

0 Answers  


what is a default tcp/ip socket assigned for sql server? : Sql server database administration

0 Answers  


We are updating a field in sql and alter the row also.after giving the commit command the system is crashed.what will happen to the commands given,whether it will update and alter the table or not?

0 Answers   Amdocs, Apps Associates,


Categories