Results 1 to 3 of 3

Thread: Addison

  1. #1
    Subtracting TIMES Guest

    Default Addison

    This is a VBScript question. I have two variables, StartTime and EndTime which are both pulling from time fields in the database. (the fields are defined in Access as "medium time format", i.e. "4:35:17 PM") I want to subtract StartTime from EndTime and retrieve the number of minutes (as a decimal value) between the times. I seem to recall that with dates I can simply state "x = EndDate - StartDate" so I&#039m dissapointed that the same isn&#039t working for times.<BR><BR>Please help if you can. This should be simple and I&#039m starting to feel silly.<BR><BR>Addison

  2. #2
    Addison Guest

    Default Subtracting TIMES

    oops, switched the name and title fields, now I DO feel silly =)

  3. #3
    tension7 Guest

    Default RE: Addison

    This will work for getting the number of minutes b/w 2 times and then convert it to a decimal by dividing by 60 (minutes..see code below...just cut and paste it to test).<BR><BR>&#060;%<BR>&#039 set a date for example<BR>datOldTime = "6:06:53 PM"<BR>&#039 get the current time<BR>datTime = Time<BR>datDifference = DateDiff("n", datOldTime, datTime)<BR><BR>Response.Write "&#060;p&#062;The number of minutes between " & datOldTime & " and " & _<BR> datTime & " is " & datDifference<BR><BR>Response.Write "&#060;P&#062;"<BR><BR>&#039 divide minute diference by 60 minutes to get decimal<BR>difDecimal = datDifference / 60<BR><BR>Response.Write "Expressed as a decimal is " & difDecimal & " of one hour."<BR>%&#062;<BR><BR>The "n" in the DateDiff function is the interval you want to measure on. "n" = minutes. For more detailed info on the DateDiff function, go to .<BR><BR>-laffit<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts