title: converting date to datenum using pandas giving invalid token errors
body: <p>I am trying to change python datetime into  matlab datenum by using
  <a href="https://stackoverflow.com/questions/8776414/python-datetime-to-matlab-datenum/9391765#9391765">this</a> and <a href="https://stackoverflow.com/questions/8776414/python-datetime-to-matlab-datenum/9260102#9260102">this</a></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> def datetime2matlabdn(dt):
     ord = dt.toordinal()
     mdn = dt + timedelta(days = 366)
     frac = (dt-datetime(dt.year,dt.month,dt.day,0,0,0)).seconds / (24.0 * 60.0 * 60.0)
     return mdn.toordinal() + frac</code></pre>
  </div>
  </div>
  </p>
  <p>when I call datetime2matlabdn(2021-08-28 10:30:00)  it throws  FOLLOWING ERRORS</p>
  <pre><code>datetime2matlabdn(2021-08-28 10:30:00)
  Syntax Error: invalid token
  </code></pre>
  <p>what is wrong with my syntax? if I try to remove these zeros then it throws invalid syntax error.
  I figured out I need to strip the zeros
  I tried some thing like this but it is not working</p>
  <pre><code>dt=dt.strptime('2021-06-28 10:30','%Y-%m-%d %H:%M')
      dn=datetime2matlabdn(dt)
  </code></pre>
  <p>how can I strip my zeros in function.
  any help would be appreciated.</p>