Get the dates of Yesterday, Today, and Tomorrow using NumPy
In NumPy with the help of NumPy.datetime64(‘today’, ‘D’), we will find today date and if we want some date before today then we will subtract the no-of-date with the help of np.timedelta64() from today. And if we want some date after today then we will add the no of date with the help of np.timedelta64() from today.
For yesterday, we will subtract 1 date, for tomorrow we will add 1 date.
Example #1: Get the dates yesterday, today, and tomorrow.
Today: 2020-08-15 Yestraday: 2020-08-14 Tomorrow: 2020-08-16
Example #2: Get the dates in the interval.
Today: 2020-08-15 before_2_day : 2020-08-13 after_2_day : 2020-08-17