Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9267591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:35:16+00:00 2026-06-18T14:35:16+00:00

In my Django app I’ve got a Task model with some date and time

  • 0

In my Django app I’ve got a Task model with some date and time fields:

class Task(models.Model):

    date = models.DateField()
    start_time = models.TimeField(help_text='hh:mm')
    end_time = models.TimeField(help_text='hh:mm')
    # more stuff

I’ll send some Task instances to some Android clients that will be in a time zone (TZ1) different from my server time zone (TZ2).

The start_time and end_time fields must be set to the target time zone (TZ1), i.e. if I enter ’13:00′ in the start_time field in the Task admin, it should be ’13:00′ in TZ1.

How can I set the start_time and end_time values to be TZ1 times? If I leave the values entered in the default admin I guess the times will be set to the server time zone (TZ2), right?

Then what’s the best format to send these values (through JSON) to the Android clients to get the correct TZ2 time?

Now I’m using Python Datetime’s isoformat(), which gives something like

2013-02-11T13:17:23.811680

but it has no time zone data…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:35:17+00:00Added an answer on June 18, 2026 at 2:35 pm

    This is not the best way to handle timezones.

    The best way is to convert times to UTC as early as possible and convert them back as late as possible.

    In other words, if I enter the current time here as Feb 11, 21:03, it should never be stored like that. Instead it should be changed to UTC before anything else happens.

    That’s so, no matter what happens with it, it’s correct. If I send it to Inner Mongolia, it should stay as UTC right up until the point someone wants to look at it. Then and only then should it be converted (and for display only).

    Following that rule will save you a lot of grief in any software that has to work across multiple timezones. Trust me on that, we fixed a major Telco up after they’d implemented some hideous system that sent timezones across the wire, meaning that every point had to be able to convert to and from every timezone.

    Getting them into UTC as quickly as possible, and only getting them back on demand, saved bucketloads of time and money.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my django app, I have these models class Lesson(models.Model): name = models.CharField(max_length=200) course
In my Django App I have the following model: class SuperCategory(models.Model): name = models.CharField(max_length=100,)
I have a django app with some model for uploading files. I need to
I'm running a Django app on Apache + mod_python. When I make some changes
I have a Python/Django app that will require database load balancing at some point
A Django app that I am working has an Event model. An Event may
I have a django app with four models in it. I realize now that
In my Django app, I have a page.html that includes forms from multiple models
In my django app, a Task can have PENDING or FINISHED status .Which is
My django app parses some files uploaded by the user.It is possible that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.