473,327 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

time conversion

Hi,
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
Thanks
--
Andrew

Jul 19 '05 #1
9 3919
Andrew wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36


<http://groups.google.com/groups?selm=7i6qdp%24d0j%241%40news1.xs4all.nl>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
Evertjan. wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:
Andrew wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36


<http://groups.google.com/groups?selm=7i6qdp%24d0j%241%40news1.xs4all.nl>


Or more recent:
<http://groups.google.com/groups?
selm=Xns944B7A0BC6853eejj99%40194.109.133.29>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3
Look into the Format function;

e.g.: Response.Write Format(Time(), "hhmmss")

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Andrew <du******@yahoo.com> wrote in message
news:XC*********************@news01.bloor.is.net.c able.rogers.com...
Hi,
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
Thanks
--
Andrew

Jul 19 '05 #4
Format() is not available in ASP.

For alternatives, see these articles:
http://www.aspfaq.com/show.asp?id=2271
http://www.aspfaq.com/show.asp?id=2313

"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
Look into the Format function;

e.g.: Response.Write Format(Time(), "hhmmss")

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Andrew <du******@yahoo.com> wrote in message
news:XC*********************@news01.bloor.is.net.c able.rogers.com...
Hi,
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
Thanks
--
Andrew


Jul 19 '05 #5
"Andrew" wrote:

How can I convert seconds to hh:mm:ss format?
e.g. 123456s = 34:17:36


Number.prototype.pad = function(d) {
var val = String(this)
d = Math.max(d,val.length)
for (var i=0; i<d; i++) val = "0" + val
return val.substring(val.length-d)
}

var seconds = 123456,
hh = Math.floor(seconds/3600),
mm = Math.floor(seconds%3600/60),
ss = seconds%60

return hh.pad(2) + ":" + mm.pad(2) + ":" + ss.pad(2)

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #6
Got it, thanks

--
Andrew
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Andrew wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36


<http://groups.google.com/groups?selm=7i6qdp%24d0j%241%40news1.xs4all.nl>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #7
Uummm, this is vbscript, not vb/vba. No builtin Format() function in
vbscript.

Besides, this will not convert an integer containing a number of seconds to
a string in hh:mm:ss format.

Steven Burn wrote:
Look into the Format function;

e.g.: Response.Write Format(Time(), "hhmmss")
Andrew <du******@yahoo.com> wrote in message
news:XC*********************@news01.bloor.is.net.c able.rogers.com...
Hi,
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
Thanks
--
Andrew


Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #8
I've got it working just fine in one of my scripts. (working alongside FSO)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Foo Man Chew <fo*@man.chew> wrote in message
news:#7**************@TK2MSFTNGP12.phx.gbl...
Format() is not available in ASP.

For alternatives, see these articles:
http://www.aspfaq.com/show.asp?id=2271
http://www.aspfaq.com/show.asp?id=2313

"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
Look into the Format function;

e.g.: Response.Write Format(Time(), "hhmmss")

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Andrew <du******@yahoo.com> wrote in message
news:XC*********************@news01.bloor.is.net.c able.rogers.com...
Hi,
How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
Thanks
--
Andrew



Jul 19 '05 #9
> I've got it working just fine in one of my scripts. (working alongside
FSO)

Format is VB / VBA, not VBScript. So the only way you could have it working
is if you had a custom format() function, like the one in one of foo's
links.
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dan glenn | last post by:
Say, I want to set a cookie and have it expire an hour after it's set. It's looking like this is only possible for browsers which are in the same time zone as my server?? In other words, if I...
2
by: learning_C++ | last post by:
I programmed this code with a function "get_current_time" in the begining. When I compiled with the command g++ -Wall -g xxx.xpp -o xxx there are so many errors. please help me and thanks, ...
1
by: heirou | last post by:
I'm a novice in this subject....I've made a database that requires a time conversion. For example, if local time is 1200, determine the time in Korea. I use two fields: a date field, and a time...
6
by: DCSudolcan | last post by:
I know that a program can create and properly initialize an array of pointers to functions at build time, but can something like the following be done at build time? void foo(void); unsigned...
5
by: Paulers | last post by:
Hello, I'm working on an app that requires the functionality to convert the time in Austrailia to the time in New York (EST). I am wondering, what is the bestway to approach this in vb.net? Is...
3
by: Jason S | last post by:
is there any way to use templates to bind integer/floating point constants to a template for compile-time use? e.g. template <double conversion> class meters { const factor = conversion;
3
by: moni | last post by:
Hi, I wanted to convert a time value in the form of time_t into a readable form in C# or vice versa, in order to be able to subtract two time values and give the result in msecs. eg. I...
3
by: Evan Klitzke | last post by:
Although it is not present in ANSI C, the GNU version of stftime supports the conversion character %z, which is a time offset from GMT. The four digit time offset is required in RFC 2822...
5
by: fimarn | last post by:
I am trying to get rid of compile time error that I am getting only in RHEL5 (not in RHEL4) apparently due to the changes in the stl_list.h file. The error that I am getting is coming from the...
5
by: Grey Alien | last post by:
I need to convert timestamps that are given as the number of seconds that have elapsed since midnight UTC of January 1, 1970, (not counting leap seconds). It seems all of the std C functions...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.