Skip to content

Instantly share code, notes, and snippets.

@h3nryza
Created July 18, 2018 08:12
Show Gist options
  • Select an option

  • Save h3nryza/729866532cd036f8b458d3b7db0a553d to your computer and use it in GitHub Desktop.

Select an option

Save h3nryza/729866532cd036f8b458d3b7db0a553d to your computer and use it in GitHub Desktop.
Python date time for filename use
#!/usr/bin/python
# -*- coding: <utf-8> -*-
from __future__ import print_function
import datetime
dDate = datetime.datetime.now().strftime("%m/%d/%Y %I:%M:%S %p")
dDate2 = datetime.datetime.now().strftime("%m-%d-%Y_%I%M%S%p")
location = "C:/temp/"
filename = "test.test"
filename = location + "_" + filename + "_" + dDate2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment