Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL
Time range select with or without SQL Time range select with or without SQL
Time range select with or without SQL
Go Back  Xtreme Visual Basic Talk > > > Time range select with or without SQL


Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2009, 07:49 AM
4z4zel 4z4zel is offline
Newcomer
 
Join Date: Nov 2009
Posts: 1
Default Time range select with or without SQL


Hello,

First I would like to say Hi as it is my first post.

I already have a problem..

Im trying to get the soft recognize the timerange between times:

For example:
START TIME: 10:00
End TIME: 15:00

This works well with this code:

Code:
 sStart = dtStart.ToString("HH:mm")
        sEnd = dtEnd.ToString("HH:mm")
        sNow = Now().ToString("HH:mm")

        sStart = "10:00"
        sEnd = "15:00"


        Select Case snow
            Case sStart To sEnd
                MsgBox("YES")
            Case Else
                MsgBox("NO")
        End Select
The problems starts when:
START TIME: 10:00
END TIME: 05:00 (next day for example)
I need to pick the time range between 10:00 and 05:00 in the morning.

I tried both - SQL Select and Visual Basic - both options didnt work when I needed to pick the time range as above. Normal ranges during the 24 hour cycle where ok.

Sorry for my newbie question and complicated explanation but I couldnt find the answer on the network..

Anyone could point me to the right direction?
Thanks in advance.
Reply With Quote
  #2  
Old 11-18-2009, 10:06 AM
torpkevuk's Avatar
torpkevuk torpkevuk is offline
Contributor
 
Join Date: Oct 2003
Location: Nebraska, USA
Posts: 640
Default

what database software are you using?
Reply With Quote
  #3  
Old 11-19-2009, 12:53 AM
IUnknown's Avatar
IUnknown IUnknown is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Oct 2004
Location: Montréal
Posts: 1,135
Default

Ignoring seconds, in a day, the time goes from 00:00 to 23:59.
To detect time from 10:00 to 05:00 the next day, you will need two ranges:
1. from 10:00 to 23:59 on the first day
2. from 00:00 to 05:00 the next day.
Code:
If dtStart.Day = Now.Day Then
  Select Case sNow
    Case "10:00" to "23:59"
      MsgBox("YES")
    Case Else
      MsgBox("NO")
    End Select
ElseIf dtStart.Day < Now.Day Then
  Select Case sNow
    Case "00:00" to "05:00"
      MsgBox("YES")
    Case Else
      MsgBox("NO")
    End Select
End If
HTH,
<iunknown />
__________________
win7 : vs 2008 : .Net 3.5
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL Time range select with or without SQL
Time range select with or without SQL
Time range select with or without SQL
 
Time range select with or without SQL
Time range select with or without SQL
 
-->