Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 706561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:10:48+00:00 2026-05-14T04:10:48+00:00

I have a table that includes some student group name, lesson time, day names

  • 0

I have a table that includes some student group name, lesson time, day names like Schedule. I am using C# with MySql and I want to find which lesson is when user press button from table.

I can find it by entering the exact value like in the table, e.g. 08:30 or 10:25. But I want to make that getting system time and checking that it is between 08:30 and 10:25 or 10:25 and 12:30. Then I can say that it is the first or second lesson.

I have also table includes Table_Time column has 5 record like 08:20 , 10:25 , 12:20 so on.
Could I use like :

select Lesson_Time 
from mydb.clock 
where Lesson_Time between (current time)-30 AND (current time)+30  

Or can I use between operator between two columns (like creating Lesson_Time_Start and Lesson_Time_End) and comparing current time like Lesson_Start_Time < current time < Lesson_End_Time?

EDIT:
More precisely ,problem is how can I check current time is which record

I have table like

Time_ID  | Lesson_Time 
    1       08:30
    2       10:25
    3       12:20
    4       14:15
    5       16:10

And When I press some button I want to check that current time when I pressed button is it equel to which Time_ID
Forexample I pressed button at 09:15 and it must select 1th record , if I pressed button at 12:00 it must select 2th record.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:10:49+00:00Added an answer on May 14, 2026 at 4:10 am

    I’d try something like this.

    select
        Time_ID,
        Lesson_Time
    from
        mydb.clock
    where
        Lesson_Time <= TIME(NOW())
    order by
        Lesson_Time DESC
    limit 0, 1
    

    The query is limited to lesson time records prior to the current time sorted descending by time and returns only the first record, which should be the record you want. (Note, however, that midnight can complicate matters.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table of countries, which includes some country names that have
I have a table it includes 3 foreign key field like that: My Table:
I have some code that creates a table like this: for($i=0; $i<$fields_num; $i++) {
I have a table of citations that includes the last name of the first
I have a table that includes 27 DropDownLists for user input. My table has
I have a table of userdata that includes user ID and category IDs. I
I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45
I have a table that looks like this: id value AGA 0.211 AGA 0.433
I have a table that looks like this: CREATE TABLE foobar ( id SERIAL
I have some columns in my table, descriptions column contains some information like; a1b01,Value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.