3

I am using dateparser python's module to parse dates. How can I get dateparser to count not from the current date and time, but from the date I set, like today = datetime(2021, 1, 1)?

ferrum
  • 169
  • 1
  • 13
  • Welcome to [Stack Overflow.](https://stackoverflow.com/ "Stack Overflow") Please be aware this is not a code-writing or tutoring service. We can help solve specific, technical problems, not open-ended requests for code or advice. Please edit your question to show what you have tried so far, and what specific problem you need help with. See the [How To Ask a Good Question](https://stackoverflow.com/help/how-to-ask "How To Ask a Good Question") page for details on how to best help us help you. – itprorh66 Jul 09 '21 at 17:38
  • 2
    This is not a code-writing question. It's a reasonable question for people who is familiar with DateParser. – Danny Wang Jan 09 '22 at 12:19

1 Answers1

3

Use RELATIVE_BASE in settings.

For example:

parse('tomorrow', settings={'RELATIVE_BASE': datetime.datetime(2020, 1, 1)})
Danny Wang
  • 429
  • 9
  • 24