Calculating Our Age in Days

Kirthiga
Posted by Kirthiga under Sql Server category on | Points: 40 | Views : 858
Declare @Diff table(DateOfBirth varchar(19),Today varchar(19))
insert into @Diff values('1989-01-01 06:30 AM',GETDATE())
select convert(varchar, DATEDIFF(HOUR,DateOfBirth,Today)/24) +' Days '
+convert(varchar, DATEDIFF(HOUR,DateOfBirth,Today)%24) +' Hrs' Age from @Diff

Comments or Responses

Login to post response