Results 1 to 4 of 4

Thread: Time in ASP

  1. #1
    Join Date
    Aug 2004
    Posts
    77

    Unanswered: Time in ASP

    Assume that all of time was kept in variable which is array like this. Note that tiorder is time

    tiorder2(t2)=rst5("tiorder")


    sql="select top 1 * from ("&namecompany2(i2)&") where price <= "&limitprice2(j2)&" and ti > #&tiorder2(t2)&#"

    The problem is ti > #&tiorder2(t2)&#" it doesn't work



    Note that tiorder2(t2) keep time

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I think you are trying for something like....
    Code:
    ti > "#" & tiorder2(t2) & "#"
    Actually you are probabyl better to go with a CDate idea like...
    Code:
    CDate(ti) > CDate(tiorder2(t2))
    At least then you know you are comparing two dates...
    Last edited by rokslide; 09-27-04 at 01:22. Reason: Rethink.....

  3. #3
    Join Date
    Aug 2004
    Posts
    77
    The type of time that I use in column ti is date/time hh:nn:ssAM/PM
    Id ti
    1 9:00:01AM
    2 10:00:01AM
    3 10:12:45AM
    4 10:30:01AM

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    errgghhh.... that's not good.... okie, something that will work.... (although there may be better ways, I haven't played much with time values)

    reformat your time to 24 hour using something like...
    Code:
    24Hour(ti) > 24Hour(tiorder2(t2))
    
    Function 24Hour (myTime)
      arrTime = split("9:00:01AM",":")
      AMPM = mid(arrTime(2),3)
      myHour = arrTime(0)
      myMinute = arrTime(1)
      mySecond = left(arrTime(2))
    
      if AMPM="PM then myHour = myHour +12
    
      24hour = myHour & myMinute & mySecond
    end function

Posting Permissions

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