How to set a variable to be “Today's” date in Python/Pandas

后端 未结 8 2248
醉话见心
醉话见心 2020-12-23 19:35

I am trying to set a variable to equal today\'s date.

I looked this up and found a related article:

Set today date as default value in the model

Howe

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 20:03

    pd.datetime.now().strftime("%d/%m/%Y")

    this will give output as '11/02/2019'

    you can use add time if you want

    pd.datetime.now().strftime("%d/%m/%Y %I:%M:%S")

    this will give output as '11/02/2019 11:08:26'

    strftime formats

提交回复
热议问题