Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use Numpy to get the dates of today, tomorrow and yesterday

Shulou Source: shulou.com Published: 2022-06-01 07:53:17 09月26日 Update

This article mainly introduces "how to use Numpy to get the dates of today, tomorrow and yesterday". In daily operation, I believe many people have doubts about how to use Numpy to get the dates of today, tomorrow and yesterday. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts of "how to use Numpy to get the dates of today, tomorrow and yesterday." Next, please follow the editor to study!

Get the date of today, tomorrow and yesterday.

Import numpy as np

Yesterday = np.datetime64 ('today','D')-np.timedelta64 (1) today = np.datetime64 (' today','D') tommorow = np.datetime64 ('today','D') + np.timedelta64 (1) print (yesterday) print (today) print (tommorow)

Print the results:

2019-04-222019-04-232019-04-24 this is the end of the study on "how to use Numpy to get the dates of today, tomorrow and yesterday". I hope I can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Date study more help practical next articles methods theories knowledge articles results websites materials follow questions easy to use practice solutions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno Xiaomi NVidia MySQL