HELP!!

I want to search for a row in a table using current date that falls between a start and end date, using DBIx::Class. The data type for the 2 date columns (in SQL Server) is datetime.

my $dt = DateTime->now( time_zone => "America/New_York" ); my $mydatarow = $schema->resultset( 'DataTable' )->search({ START_DATE + => { '>=' => $dt }, END_DATE => { '=<' => $dt }})->single;

The results are empty, yet when I go into the database there is a record that meets my criteria. The record that meets the criteria is
START_DATE = 2019-09-03 00:00:00.000 and
END_DATE = 2019-12-20 00:00:00.000.

The current date is 2019-09-05. $dt is 2019-09-05 00:00:00.

I am using DBIx::Class::InflateColumn::DateTime as part of my database package.

What can I do to make this return the result I am looking for?

Thanks for your help!


In reply to Searching a Date between 2 dates with DBIx::Class by phildeman

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.