473,657 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1588
joe ruggeri wrote on 02 mrt 2005 in
microsoft.publi c.inetserver.as p.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("myti mefield"))

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("myda te"),"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("myda te"),"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
9436
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 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
3
6050
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
4643
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 having a heck of a time doing so. I have created a form where I use drop downs do specify year, month, date, hour, minute and seconds. When the form is loaded, the dropdowns have to display the proper values for the current time zone type. This
12
3420
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 to work only to see that it takes 30-60 seconds to run the query, instead of the usual .5 seconds when I use a query without a function. Here is the code for the function. I call it using
3
3291
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 the field should only be showing one or the other (date or time). Even on the back end of the database where the column properties are, I have chosen the smallest date/time formats. When the aspx page runs, it shows the date and time (ie:in a...
5
1333
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. Are there any formatting functions available or do I need to make my own? Perhaps there is something similar to C's printf formatting. Thanks,
1
1676
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, Time)
7
1665
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 formatting it with yyyy ... aso, made the mistake with mm and MM but got it befre someone saw) but really think its strange, excel dosent like that format either. M$ not m$ compatible? Not a problem for me at the moment, just itrested if im missing...
14
21202
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 incorrect. Any ideas? I tried both convert... and datetime.par...
0
16489
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 formatting considerations at all. They are simple, easy, and brief and you should use them any time you need to incorporate any date literals or date math in your T-SQL code. create function DateOnly(@DateTime DateTime) -- Returns @DateTime...
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.