Is there a way to use the Django timestamp without using a model? I want to write the timestamp to a file. The reason I want to use the Django one and not datetime or time from python is because I already set the Time Zone for it in settings so it would be more convenient if I could just use that.
Yes
from django.utils import timezone
now = timezone.now()
Also make sure that USE_TZ=True. This is automatically set to False. If this isn't set to True then timezone.now() will not be set to your timezone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With