how to convert char to time
-
Hi all i want to convert char data to datetime but it dosent give me reqd output
select convert(char(8),fieldname,108) as myTime from TableName
fieldname datatype is char(8) it contain values like 1004,1200,1354 required outpot as 10:04,12:00,13:54 i used above expression but it doesn`t convert data in hh:mm:ss plz helpThe Stifler -- Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
-
Hi all i want to convert char data to datetime but it dosent give me reqd output
select convert(char(8),fieldname,108) as myTime from TableName
fieldname datatype is char(8) it contain values like 1004,1200,1354 required outpot as 10:04,12:00,13:54 i used above expression but it doesn`t convert data in hh:mm:ss plz helpThe Stifler -- Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
This will show the result in the required format, but it does not convert it to datetime:
Select substring(fieldname,1,2) +':'+ substring(fieldname,3,2)
Hesham A. Amin My blog