[Python] Rendering datetime and proper formatting

Discussão em 'Python' iniciado por Stack, Dezembro 7, 2024.

  1. Stack

    Stack Membro Participativo

    I have a django project to keep track of tasks in a office enviroment. I have this model for tasks and it has a finish_date attribute that its assigned as soon i acces the route to done the desired task. I'm trying to use datetime and pytz to correctly format the date to the DateTimeField attribute.

    Here's the view code:

    task.data_conclusao=datetime.now().astimezone(pytz.timezone('America/Sao_Paulo'))
    task.save()


    It's saving the datetime but when i render it on the html, it just doesnt adjust to the timezone i set. Can anyone help me?

    Continue reading...

Compartilhe esta Página