473,407 Members | 2,598 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,407 software developers and data experts.

Time Formatting in ASP

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 jo*****@jfmedia.com
-----------------------------------------------------
Jul 22 '05 #1
3 1558
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

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #2
joe ruggeri wrote:
[...]
Any ideas?


checked the function "Format" already?
http://msdn.microsoft.com/library/de...afctFormat.asp
http://msdn.microsoft.com/library/en...fctformatx.asp



you can use the function somehow like that:
response.write format(rs("mydate"),"h:mm:ss")
Jul 22 '05 #3
Simon Felix wrote:
joe ruggeri wrote:
[...]
Any ideas?
checked the function "Format" already?


What's that got to do with vbscript?

http://msdn.microsoft.com/library/de...afctFormat.asp http://msdn.microsoft.com/library/en...fctformatx.asp

you can use the function somehow like that:
response.write format(rs("mydate"),"h:mm:ss")


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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #4

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

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
3
by: beliavsky | last post by:
Using Python 2.4 on Windows, for me the command print os.stat("temp.txt") gives 1115478343 , which is "seconds since the epoch". How can I get the modification time in a format such as
11
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
12
by: strict9 | last post by:
Hello all, I'm writing several queries which need to do various string formating, including changing a phone number from (123) 456-7890. After some problem with data mismatches, I finally got it...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
5
by: HMS Surprise | last post by:
I wish to generate a datetime string that has the following format. '05/02/2007 12:46'. The leading zeros are required. I found '14.2 time' in the library reference and have pulled in localtime....
1
by: jonny | last post by:
Option Explicit Private mdTarget1 As Date Private mdTarget2 As Date ' called on form load Public Sub SetRecordStartTime() mdTarget1 = DateAdd("n", 60, Time) mdTarget2 = DateAdd("n", 120,...
7
by: christery | last post by:
Anyone got a clue to why ther is a T between date and time in the "formatted for sorting" or whatewer they call it, and a Z at the end after seconds- got it fixed for my cobol programmer by...
14
by: Arjen | last post by:
Hi, I have a string with this value 07/11/2008. As you see no time included. How can I parse this string to a datetime variable? I tried to do this but I get the exception that the format is...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.