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

Explain what is analysis service repository?

0 Answers  


One table Test with single column. These are the values in the table a b c d e f g h I need a query (without using any variable) with output as - a b c d e f g h

1 Answers  


What is database architecture? : SQL Server Architecture

0 Answers  


how to take backup bcp out for a column in table in sql server?

0 Answers  


What is the difference between mysql and sql server?

0 Answers  






How adventureworkslt tables are related?

0 Answers  


Working with TLogs

0 Answers  


Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?

0 Answers  


what type of index will get created after executing the above statement? : Sql server database administration

0 Answers  


What is the query and subquery?

0 Answers  


What is the bookmark lookup and rid lookup?

0 Answers  


What is 5nf in normalization form?

0 Answers  


Categories