Last active
December 15, 2019 14:40
-
-
Save Sheikh2Imran/9da3e4701f71eb29b86ca889eae570d1 to your computer and use it in GitHub Desktop.
Convert date object into a desired format (Ex- 16-12-2019)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from django.utils import timezone | |
| now_time = timezone.now().timetuple() | |
| formatted_time = time.strftime("%d-%m-%Y %H:%M:%S", now_time) | |
| print(formatted_time) # it will print '15-12-2019 10:49:54' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment