1

I run my Python scripts with python -m unittest discover command. I'd like to passing current time yyyymmddhhmmssas parameter into execution command.

How can do that?

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Mahsum Akbas
  • 1,523
  • 3
  • 21
  • 38

1 Answers1

1

If you want to sample the current time on the system running the puthon code, you can use datetime.datetime.now() (local time) or datetime.datetime.utcnow() (UTC).

Then you can format as string using .strftime("%Y%m%d%H%M%S").

Freek Wiekmeijer
  • 4,556
  • 30
  • 37