Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 9th, 2006, 09:33 AM
Authorized User
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculate Time

I am making an ASP table with many rows, each row is for a 15 minute period of time in the day. My asp loops through and shows the table exactly how I want it. However, I need a way to show the time in the first column. For example, my first loop through time will be 0:00. Then for the second loop through I add 15 minutes to make it 0:15, then 0:30, 0:45 1:00, and so on.

Is there any way to do this?


Old April 10th, 2006, 08:30 AM
Authorized User
Join Date: Mar 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts

Sure; a bit of programming:

m = 0
h = 0

For i = 1 to manyRows
m = m + 15
if m >= 60 then
   m = m - 60
   h = h + 1
end if

sTime = Cstr(h) & ":" & pad0(m)

  ... 'use sTime where you want the time...


Function pad0(n)

If n >= 10 then
   pad0 = Cstr(n)
   pad0 = "0" & Cstr(n)
end if

end function


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to calculate elapsed time. RayL Access VBA 4 May 24th, 2007 12:04 PM
Calculate time divovsky Access 2 March 15th, 2007 03:10 PM
calculate a number between two dates in time t400 SQL Server 2000 8 September 5th, 2006 01:14 PM
calculate time between two dates RMorales2831 Access 1 February 13th, 2004 11:38 PM
Calculate time period dtaya Access 1 July 26th, 2003 07:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.