"Subtracting" 2 different times

Results 1 to 2 of 2

Thread: "Subtracting" 2 different times

  1. #1
    Join Date
    Dec 1969

    Default "Subtracting" 2 different times

    There is probably a very simple answer to this but does anyone know how you can find out the difference between two times, one taken from a database and the other from the Time() command (both set in hh:mm:ss format)<BR><BR>This is how I have done it:<BR>Mytime= Time() <BR>Myaddtime = objRS("PostTime")<BR>Mydifference = Mytime - Myaddtime<BR><BR>And this is the type of output I get:<BR>7.33796296296296E-03<BR><BR>Anyone know the proper way that gives you a time and not a silly long winded number?<BR><BR>What I&#039;m trying to do is find out if the current time is within 6 hours of the time posted in the database for which I would print the headline "Breaking News". But if the time is longer than 6 hours from the current time I&#039;d print out "Top Story" instead.<BR><BR>Any help would be appreciated. <BR><BR>Cheers, Mark

  2. #2
    Join Date
    Dec 1969

    Default RE:

    I think you need both times in date format... after all, what will happen if the time wraps over to the next day - it&#039;ll break your comparison. Then you can use DateDiff(h,..) function to compare the times..

Posting Permissions

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