[Python] Why do i keep getting UTC time zone even when Django settings is configured...

Discussão em 'Python' iniciado por Stack, Julho 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm not sure why the datetime response is always one hour behind (UTC)

    Django settings configuration

    LANGUAGE_CODE = "en-us"
    TIME_ZONE = "Africa/Lagos"
    USE_I18N = True
    USE_L10N = True
    USE_TZ = True
    DATE_FORMAT = "F j, Y"
    SITE_ID = 1


    from django.utils import timezone
    timezone.now()

    response:
    datetime.datetime(2022, 7, 23, 13, 58, 6, 739601, tzinfo=<UTC>)


    You can see that the time zone info is UTC

    Continue reading...

Compartilhe esta Página