{"id":717,"date":"2022-02-24T13:15:43","date_gmt":"2022-02-24T18:15:43","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=717"},"modified":"2022-02-24T13:15:45","modified_gmt":"2022-02-24T18:15:45","slug":"python-code-to-get-current-date","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/python-code-to-get-current-date\/","title":{"rendered":"Python code to get current date"},"content":{"rendered":"\n<p>The following code prints the current date:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import datetime as dt\nnow = dt.datetime.now()\nprint(now.year)\nprint(now.month)\nprint(now.day)<\/code><\/pre>\n\n\n\n<p>First we import datetime library. now() function gets the current date and time from the server. now.year, now.month, and now.day prints current year, month, and day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following code prints the current date: First we import datetime library. now() function gets the current date and time from the server. now.year, now.month, and now.day prints current year, month, and day.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203],"tags":[7,137],"class_list":["post-717","post","type-post","status-publish","format-standard","hentry","category-python","tag-date-manipulation","tag-python"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=717"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/717\/revisions"}],"predecessor-version":[{"id":718,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/717\/revisions\/718"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}