| Author |
Topic |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-01-27 : 15:38:34
|
| What's the easiest way to cast an integer of minutes into a character string like HH:MM?Anyway to use CONVERT? 114, 108 especially? |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-01-27 : 16:02:10
|
You'd still have to convert the values if you'd want to use it as a dateDECLARE @min intSELECT @min = 123SELECT RIGHT('00' + CONVERT(varchar(2),@min/60),2)+ ':' + RIGHT('00' + CONVERT(varchar(2),CONVERT(int,((@min/60.00)-(@min/60))*60)),2)Brett8-) |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-01-27 : 16:24:02
|
I'm not sure you're a minimalist Brett... And why isn't there a MOD or MODULO function in SQL Thanks for the (long) answer!Sam |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-27 : 16:25:48
|
or you could use mod (%)DECLARE @min intSELECT @min = 123SELECT RIGHT('00' + CONVERT(varchar(2),@min/60),2)+ ':' + RIGHT('00' + CONVERT(varchar(2),@min%60),2)Corey "If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-27 : 16:26:07
|
danggit! Corey "If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-27 : 16:28:55
|
or DECLARE @min intSELECT @min = 123Select left(convert(varchar,dateadd(n,@min,0),108),5) Corey "If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-01-27 : 16:30:31
|
| Corey has some minimalist traits. And reads BOL too... |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-27 : 16:34:40
|
Do I win something ?? No... *sigh*Corey "If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-01-27 : 16:35:46
|
| Well, you could join the minimalist (uh what did Brett call it? religion?)We call ourselves: min |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-27 : 16:44:26
|
snds gdcnt me n Corey "If th nly tol u hv is a hmmr, th whl wrld lks lk a nal." - Mrk Twn |
 |
|
|
|