• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 647
  • Last Modified:

how to convert nvarchar to datetime

nvarchar contains data like 01:30 now i want to convert into datetime for compare two time plz reply ASAP

Thanks
0
gopalhazel
Asked:
gopalhazel
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
select convert(datetime, '01:30', 108)
0
 
OP_ZaharinCommented:
select convert(datetime, <fieldname>,8)
0
 
OP_ZaharinCommented:
OR select convert(varchar(5),<fieldname>,8)
0
 
kamindaCommented:
I would do it like this

SELECT CAST('01:08' AS DATETIME)
0
 
lalitgadaCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now