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 9003823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:45:37+00:00 2026-06-16T00:45:37+00:00

I have orders that come in it at various times during the week and

  • 0

I have orders that come in it at various times during the week and I have a set of rules for when we can and cannot accept orders. For example, we don’t accept orders between 4:45pm and 5:15pm on Wednesday. So if an order came in at 3pm, everything is fine. If an order came in at 5pm we would need to reject it. These rules are based on the day of the week and change daily.

My question, is using joda time, what is the best way to check if the current time is in this time window?

I’m open to other technologies, however I’m currently using joda time through the scala tools time wrapper.

I’m currently working with something like this:

  val now = DateTime.now
  val wednesdayNoTradeInterval:Interval = ??

  now.getDayOfWeek match {
    case WEDNESDAY => wednesdayNoTradeInterval.contains(now)
  }
  • 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-06-16T00:45:37+00:00Added an answer on June 16, 2026 at 12:45 am

    You might try something like this:

    implicit def dateTimeToLocalTime(dateTime: DateTime) = dateTime.toLocalTime
    type Interval[T] = (T, T)
    def during(interval: Interval[LocalTime])(time: LocalTime) = interval match {
      case (start, end) => start < time && time < end
    }
    
    def day(day: Int)(time: DateTime) = time.dayOfWeek.get == day
    
    val fourish = new LocalTime(16, 45)
    val afternoon = during((fourish, (fourish + (30 minutes)) )) _
    val wednesday = day(WEDNESDAY) _
    val thursday = day(THURSDAY) _
    def acceptingOrders = !{
      val now = DateTime.now
      wednesday(now) && afternoon(now)
      thursday(now) && afternoon(now)
    }
    

    And use it like this:

    acceptingOrders  // ?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some Orders that can have several Items and these Items have an
I'm trying to select orders that have either over or under 2000 products ordered
I have a site that processes orders taken by phone into a SQL database.
I have a typical enterprise/business application that I am developing that includes orders, salespersons,
I have an entity Company that has many Orders. I mapped these as following
Lets say that I have three tables, customers, orders and orderDetails. I'm doing this:
We have a reporting solution that works like this. User orders the report to
I have a SQL Server table full of orders that my program needs to
I have this GUI that shows, let's say Customer Orders. When my client nailed
I have a number of xml's that come in haphazardly that contain a Ocount,

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.