12,954,856 members (61,805 online)
Rate this:
See more:
my first problem : i have to convert 110 minute into time format means 01:50:00 (hh:mi:ss).
how to do this.?

my second problem : i have convert date to minute.But in that case i cant able to convert second into minute and add it to minute.
my calculation is here:
i have date : 1/9/2012 1:30:12AM
convert to minute returns : 90

```
SELECT     name1, address, mob, city, emailid,(datepart(hh,[date]) * 60) + datepart(n, [date]) + (datepart(ss,[date])/60)
FROM         [user.]
```
Posted 8-Feb-13 7:15am
Updated 8-Feb-13 8:16am
v2

Rate this:

## Solution 1

replace [YourInput] to your time in minuted

`Select CAST(([YourInput] / 60) as varchar(2)) + ':' + CAST(([YourInput] % 60) as varchar(2))`

the function can be found from the following location

http://stackoverflow.com/questions/2944580/minutes-to-time-in-sql-server[^]
Rate this:

## Solution 2

`new System.TimeSpan ( 0 , 150 , 0 ).ToString()`

```System.DateTime d = System.DateTime.Parse ( "1/9/2012 1:30:12" ) ;
double minutes = d.TimeOfDay.TotalMinutes ;```

This yields 90.2 -- what you do with the fractional part is up to you; Round, Ceiling, Floor, etc.

And if you want your SQL to add the seconds as partial minutes, you can change the second `60` to `60.0` -- you should then get 90.2 there are well.
v3

he is looking to do it in SQL server
richcb 8-Feb-13 14:19pm

PIEBALDconsult 8-Feb-13 14:20pm

I wouldn't assume that.
PIEBALDconsult 8-Feb-13 14:20pm

No, he's looking for a C# answer -- see the tags.
richcb 8-Feb-13 14:25pm

Look at the code he posted though, it is not C#. Nowhere in his post does it mention any language other than the code posted.
PIEBALDconsult 8-Feb-13 14:28pm

It's in the tags.

He's asking for a C# version of the SQL code -- lots of people ask for language translations.

Top Experts
Last 24hrsThis month
 OriginalGriff 130 Kornfeld Eliyahu Peter 80 Dave Kreskowiak 68 CHill60 60 RickZeeland 55
 OriginalGriff 6,539 CHill60 3,490 Maciej Los 3,153 ppolymorphe 2,030 Jochen Arndt 1,975