Solved

how to convert nvarchar to datetime

Posted on 2011-03-07
5
636 Views
Last Modified: 2012-05-11
nvarchar contains data like 01:30 now i want to convert into datetime for compare two time plz reply ASAP

Thanks
0
Comment
Question by:gopalhazel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 35065417
select convert(datetime, '01:30', 108)
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35065525
select convert(datetime, <fieldname>,8)
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35065532
OR select convert(varchar(5),<fieldname>,8)
0
 
LVL 9

Accepted Solution

by:
kaminda earned 500 total points
ID: 35066056
I would do it like this

SELECT CAST('01:08' AS DATETIME)
0
 
LVL 1

Expert Comment

by:lalitgada
ID: 35067533
it is too hard first of all it will check based on system date time format structure then culture.

you have to think on the culture format and date time format and the format structure you have set as time zone,

because the sql take system time format as default.
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question