I realise it's not a Perl answer, but if you're getting the record from a database you may find that the database engine can do this work for you.
AFAIK, all the major platforms include functions to allow you to compare, add and subtract dates/times.
A simple query like
select 1 where $my_date_time > $start_date_time and $my_date_time < $end_date_time
might be sufficient.
If your database record stores only times, not dates/times, you might get some mileage from looking into your database platform's commands for adding hours/minutes to the current time.

A second, perhaps equally unhelpful suggestion:
As you've doubtless discovered, 22:40 may or may not be between 22:00 and 04:00, depending on whether or not you infer 'on the same day'. If it's within your power to do so, perhaps it might be a good idea to alter the way the start/end times are stored in the database - perhaps storing the start time in conventional 24h clock notation(22:00), but then showing the duration of the task by specifiying a number of minutes (or hours, or nanoseconds - whatever unit suits best) after the start.
So, instead of
start | end ----------- 22:00 | 04:00
you'd have
start | end_after_minutes ---------------- 22:00 | 360
Not only would it then be straightforward to calculate the start and end datetime values in the database (and so carry out the comparison you're after), but you'd also be able to specify tasks which last for more than 24 hours.

In reply to Re: Check Time between 2 other times by terce
in thread Check Time between 2 other times by dtharby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.