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

Does view occupy space?

0 Answers  


plss anybody specify tha constrian management system in dbms

0 Answers   Police Constable,


How to change the name of a database user?

0 Answers  


What is better - 2nd Normal form or 3rd normal form? Why?

2 Answers   TCS, TPK,


How many types of schemas are there?

0 Answers  






What is query cost in sql server?

0 Answers  


I hav 10 records only one column 1,2,3,4,5......10 now am writing query select max(column name) Then What is The Output

9 Answers   Brigade, Wipro,


diffrence between function and procedure

5 Answers   Wipro,


What is for xml in sql server?

0 Answers  


Explain forward - only cursors?

0 Answers  


your distribution database is full what will u do

0 Answers  


What is the sql case statement used for?

0 Answers  


Categories