Skip to content Skip to sidebar Skip to footer

Get Local Date Time And Time In Django

How can I get the local date and time in Django? I tried this solution. But it works only for the date now. from django.utils import timezone now = timezone.localtime(timezone.no

Solution 1:

Extract the date and time from the local instant object.

from django.utils import timezone

now = timezone.localtime(timezone.now())
date = now.date()
time = now.time()

Post a Comment for "Get Local Date Time And Time In Django"