minutes into 'hours and minutes'

How would you distill a value in minutes into hours and minutes. example: 90 = 1,30; 200=3,20 etc using tsql code?

thanks
LVL 6
anushahannaAsked:
Who is Participating?
 
mozerukConnect With a Mentor Commented:
how about this....

DROP Table #SampleTable

CREATE Table #SampleTable (

[numasdate] int

);

 

Insert Into #SampleTable Values('9436');

Insert Into #SampleTable Values('537');

Insert Into #SampleTable Values('9323');

Insert Into #SampleTable Values('12525');

 

-- To calculate Total Hours and Minutes

Select numasdate,

Cast(numasdate / 60 as Varchar) + ' hours ' +

Cast(numasdate % 60 as Varchar) + ' minutes'

as [TotalHoursAndMinutes]

From

#SampleTable

Open in new window

0
 
anushahannaAuthor Commented:
works very well. thanks
0
 
mozerukCommented:
no problems - cheers for the feedback.
0
All Courses

From novice to tech pro — start learning today.