Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to convert nvarchar to datetime

Posted on 2011-03-07
5
Medium Priority
?
645 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

618 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