Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


Different method to convert string to date explicitly?
Question Posted on 22 Aug 2022

Home >> DataBase >> SQL Query >> Different method to convert string to date explicitly?




Different method to convert string to date explicitly?
When we sayabout the explicit conversion which is done by using some functions or tools. Below are the 3 function which helps to convert string explicitly:-
(1)CAST()
(2)CONVERT()
(3)PARSE()

(1)CAST():-It is most basic conversion function provided by SQL Server. This function will helps to tries to convert given value to a specified data type. Below is the syntax given below:-

select cast('12/01/2019' as date) as strToDate, CAST(GETDATE() as VARCHAR(50)) as DateToStr

(2)CONVERT():-CONVERT() function is more advanced than CAST() since the conversion style can be specified. And this function takes 3 arguments as given below:-
(i)Require data type
(ii)Input value
(iii)Style number(which is optional)
And below is the syntax for CONVERT()

SELECT CONVERT(DATETIME,'19/12/2019',103)

(3)PARSE():-PARSE() is SQL CLR function that use .Net framework Parse() function. PARSE() syntax is as follows:-

Select PARSE('19/12/2020' as date USING 'AR-LB')
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
How to get the table count in last used query from cache by sending tablename?
Write a SQL query to print 1 to 100 in sql server?
Sql Interview Latest Query questions asked on 30 dec 2020
nth highest number from table
some good sql query






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |