VBScript Function Question

1. Member
Join Date
Dec 1969
Posts
81

## VBScript Function Question

Hello,<BR><BR>Is there a way to pass ONE variable to a function and get THREE back? I have a function that turns seconds into hours:minutes:seconds, but it returns it as one string. I would like to get hours, min, seconds back sepretly. heres the function if it helps.<BR><BR>Function Convert(x)<BR>If tmfrmt=1 then<BR>Dim hour<BR>Dim min<BR>Dim sec<BR>dim mand<BR><BR>hour = fix(x/3600)<BR>mand = x-(hour*3600)<BR>min = fix(mand/60) <BR>sec = mand-(min*60)<BR><BR>If Sec &#060; 10 then<BR>sec = "0"& sec<BR>else<BR>end if<BR><BR>If Min &#060; 10 and Hour &#060;&#062; 0 then<BR>min = "0"& min<BR>else<BR>end if<BR><BR>If hour = 0 then<BR>Convert = min & ":" & sec<BR>Else<BR>Convert = hour & ":" & min & ":" & sec<BR>end If<BR>Else<BR>Convert=X<BR>end if<BR>end Function<BR><BR>thanks all.

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## Yes...

But then use a SUB, not a function:<BR><BR>&#060;%<BR><BR>Sub Convert(ByVal x, ByRef hrs, ByRef mins, ByRef secs)<BR> ...<BR> hrs = ...<BR> mins = ...<BR> secs = ...<BR>End Sub<BR><BR>Dim h,m,s<BR><BR>Convert 187078, h, m, s<BR><BR>%&#062;<BR><BR>BYREF is the key.<BR><BR>

3. Member
Join Date
Dec 1969
Posts
81

## RE: Yes...

thanks. thats perfect

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•