Time Formatting in ASP

J

joe ruggeri

Hey All ...

I'm developing in ASP/VBScript using DreamweaberMX, w/ an Access 2000 DB as the
data source. The source of the data is coming from a third party, which I get as
a CSV and import into the database, updating it weekly.

Since I have no control over how the data is collected, I'm not sure how to fix
this problem, but here it is.

This is a database of movies and among the many fields I import is one for the
movie's length, expressed in HH:MM:SS. This comes into the Access DB as a
Date/Time format, which means all the dates, displayed raw in the DB, look like
"12:09:52 AM". Through data formatting, however, displaying it to the client as
HH:MM:SS is no problem. (Display "12:36:00 AM" as military time (00:36:00) tells
me the movie is 0 hrs, 36 minutes, 0 seconds long. Follow?)

But in an update form, which we'll use to correct errors (and there always seem
to be errors in the running times of movies), I can't figure out how to display
it in the HH:MM:SS format in an INPUT field and have it submit without throwing
a data type mismatch error. It seems to want to display as "12:36:00 AM"

Converting the field to a text type is out of the question at this point, so I
know I need to do some type of string manipulation prior to update. However, I'm
lost ...

Any ideas?

Thanks.

- jr
--
-----------------------------------------------------
joe ruggeri
web designer
JFmedia newport, ri

401.851.2000 x-206
www.jfmedia.com (e-mail address removed)
-----------------------------------------------------
 
E

Evertjan.

joe ruggeri wrote on 02 mrt 2005 in
microsoft.public.inetserver.asp.general:
This is a database of movies and among the many fields I import is one
for the movie's length, expressed in HH:MM:SS. This comes into the
Access DB as a Date/Time format, which means all the dates, displayed
raw in the DB, look like "12:09:52 AM". Through data formatting,
however, displaying it to the client as HH:MM:SS is no problem.
(Display "12:36:00 AM" as military time (00:36:00) tells me the movie
is 0 hrs, 36 minutes, 0 seconds long. Follow?)

No,no

If it is in date/time db field the format does not matter

=================================


response.write mytime(mD("mytimefield"))

function mytime(x)
mytime = two(hour(t)) &":"& two(minute(t)) &":"& two(second(t))
end function

function two(x)
if x<10 then
two = "0" & x
else
two = "" & x
end if
end function

not tested
 
B

Bob Barrows [MVP]

Simon said:
joe said:
[...]
Any ideas?

checked the function "Format" already?

What's that got to do with vbscript?

You can definitely do that in VB/VBA. Unfortunately, there is not Format
function in vbscript, unless you write one yourself:
http://www.aspfaq.com/show.asp?id=2313

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,007
Messages
2,570,266
Members
46,864
Latest member
DaniEbswor

Latest Threads

Top