title: python-binance : How I can use time parameter to the function?
body: <p><a href="https://i.stack.imgur.com/A4xlU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A4xlU.png" alt="enter image description here" /></a></p>
  <p>I tried to use this function but I got error.
  I think need to change date format of time parameters.</p>
  <pre><code>now = datetime.now()
  past = now - timedelta(days=2)
  past = str(past)
  
  bars = client.get_historical_klines(&quot;BTCUSDT&quot;, &quot;1m&quot;, start_str = past, end_str = None, limit = 1000)
  </code></pre>
  <p>But I got error..
  When I delete the start_str and end_str, it works.</p>
  <p>How I can handle the date str for this function.
  Could you help me?!(example is the best!)</p>
  <h2><strong>---------ERROR------------</strong></h2>
  <pre><code>TypeError                                 Traceback (most recent call last)
  Input In [46], in &lt;cell line: 1&gt;()
  ----&gt; 1 bars = client.get_historical_klines(symbol=&quot;BTCUSDT&quot;, interval=&quot;1m&quot;,
        2                                             start_str=past, end_str=None, limit=1000)
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/binance/client.py:934, in Client.get_historical_klines(self, symbol, interval, start_str, end_str, limit, klines_type)
      914 def get_historical_klines(self, symbol, interval, start_str=None, end_str=None, limit=1000,
      915                           klines_type: HistoricalKlinesType = HistoricalKlinesType.SPOT):
      916     &quot;&quot;&quot;Get Historical Klines from Binance
      917 
      918     :param symbol: Name of symbol pair e.g BNBBTC
     (...)
      932 
      933     &quot;&quot;&quot;
  --&gt; 934     return self._historical_klines(
      935         symbol, interval, start_str=start_str, end_str=end_str, limit=limit, klines_type=klines_type
      936     )
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/binance/client.py:969, in Client._historical_klines(self, symbol, interval, start_str, end_str, limit, klines_type)
      966 timeframe = interval_to_milliseconds(interval)
      968 # if a start time was passed convert it
  --&gt; 969 start_ts = convert_ts_str(start_str)
      971 # establish first available start timestamp
      972 if start_ts is not None:
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/binance/helpers.py:76, in convert_ts_str(ts_str)
       74 if type(ts_str) == int:
       75     return ts_str
  ---&gt; 76 return date_to_milliseconds(ts_str)
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/binance/helpers.py:24, in date_to_milliseconds(date_str)
       22 epoch: datetime = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
       23 # parse our date string
  ---&gt; 24 d: Optional[datetime] = dateparser.parse(date_str, settings={'TIMEZONE': &quot;UTC&quot;})
       25 if not d:
       26     raise UnknownDateFormat(date_str)
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/dateparser/conf.py:92, in apply_settings.&lt;locals&gt;.wrapper(*args, **kwargs)
       89 if not isinstance(kwargs['settings'], Settings):
       90     raise TypeError(&quot;settings can only be either dict or instance of Settings class&quot;)
  ---&gt; 92 return f(*args, **kwargs)
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/dateparser/__init__.py:61, in parse(date_string, date_formats, languages, locales, region, settings, detect_languages_function)
       57 if languages or locales or region or detect_languages_function or not settings._default:
       58     parser = DateDataParser(languages=languages, locales=locales,
       59                             region=region, settings=settings, detect_languages_function=detect_languages_function)
  ---&gt; 61 data = parser.get_date_data(date_string, date_formats)
       63 if data:
       64     return data['date_obj']
  
  File ~/opt/anaconda3/lib/python3.9/site-packages/dateparser/date.py:419, in DateDataParser.get_date_data(self, date_string, date_formats)
      376 &quot;&quot;&quot;
      377 Parse string representing date and/or time in recognizable localized formats.
      378 Supports parsing multiple languages and timezones.
     (...)
      416 
      417 &quot;&quot;&quot;
      418 if not isinstance(date_string, str):
  --&gt; 419     raise TypeError('Input type must be str')
      421 res = parse_with_formats(date_string, date_formats or [], self._settings)
      422 if res['date_obj']:
  
  TypeError: Input type must be str
  </code></pre>