This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > June 2004 > format time





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author format time
Zwi2000

2004-06-14, 7:14 am

I am using ASP/VB and MS SQL 2000.

One field in my table saves seconds like: 123 ro 343

If I display on the page it shows exactly like that "123" or "343". How can
I display this in minutes instead ?

Like 2:03 ?

I have searched a lot of formatting but havent found anything other than for
dates.

Help appreciated,

Z


Joe Makowiec

2004-06-14, 7:14 am

On 14 Jun 2004 in macromedia.dreamweaver, Zwi2000 wrote:

> I am using ASP/VB and MS SQL 2000.
>
> One field in my table saves seconds like: 123 ro 343
>
> If I display on the page it shows exactly like that "123" or "343".
> How can I display this in minutes instead ?
>
> Like 2:03 ?


Not tested; may need some tweaking because of variable typing:

<% FUNCTION FormatSeconds(InputSeconds)
' Perform integer division to get the minutes
Minutes = CStr(InputSeconds\60)
' Perform modulo division to get seconds
Seconds = CStr(InputSeconds Mod 60)
' Add a leading 0 to seconds if necessary
If (InputSeconds Mod 60 < 10) Then Seconds = "0" & Seconds
' Create the formatted string
FormatSeconds = Minutes & ":" & Seconds
End FUNCTION %>

....
<td><%= FormatSeconds(123) %></td>
--
Joe Makowiec can be reached at:
http://makowiec.org/contact/?Joe
Zwi2000

2004-06-15, 4:14 am

Exelent !! ..

Thanks a million !

Z


"Joe Makowiec" <makowiec@nycap.rEMOVECAPSr.com> wrote in message
news:Xns950839B8B916FmakowiecatnycapdotrE@216.104.212.96...
> On 14 Jun 2004 in macromedia.dreamweaver, Zwi2000 wrote:
>
>
> Not tested; may need some tweaking because of variable typing:
>
> <% FUNCTION FormatSeconds(InputSeconds)
> ' Perform integer division to get the minutes
> Minutes = CStr(InputSeconds\60)
> ' Perform modulo division to get seconds
> Seconds = CStr(InputSeconds Mod 60)
> ' Add a leading 0 to seconds if necessary
> If (InputSeconds Mod 60 < 10) Then Seconds = "0" & Seconds
> ' Create the formatted string
> FormatSeconds = Minutes & ":" & Seconds
> End FUNCTION %>
>
> ...
> <td><%= FormatSeconds(123) %></td>
> --
> Joe Makowiec can be reached at:
> http://makowiec.org/contact/?Joe



Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews