Re: Timezone issue in when storing in DB

2023-08-17 Thread Fred Legace
Would it not make sense to store times in UCT then in a user profile allow the user to choose their local timezone for display? On Wednesday, August 16, 2023 at 3:15:39 AM UTC-7 Ruby wrote: > You seem to be reinventing the wheel, Django already has timezone support > when you set

Re: Timezone issue in when storing in DB

2023-08-16 Thread ivan harold
be reinventing the wheel, Django already has timezone support >> when you set USE_TZ >> <https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-USE_TZ> to >> True, >> Note that your TIME_ZONE >> <https://docs.djangoproject.com/en/4.2/ref/settings/#std

Re: Timezone issue in when storing in DB

2023-08-16 Thread Madhusudhan Reddy
But I am using only fast api for APIs On Wed, 16 Aug 2023 at 3:45 PM, Ruby wrote: > You seem to be reinventing the wheel, Django already has timezone support > when you set USE_TZ > <https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-USE_TZ> to > True, > Not

Re: Timezone issue in when storing in DB

2023-08-16 Thread Ruby
You seem to be reinventing the wheel, Django already has timezone support when you set USE_TZ <https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-USE_TZ> to True, Note that your TIME_ZONE <https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-TIME_ZONE> would be

Re: Timezone issue in when storing in DB

2023-08-15 Thread Mike Dewhirst
On 16/08/2023 12:35 pm, Madhusudhan Reddy wrote: Hi All, I am trying to store the date with the timezone. for example, my servers are in Mumbai, when my servers are trying to get the time of America/Detroit. it is not able to get proper time pytz is deprecated. You should consider using

Timezone issue in when storing in DB

2023-08-15 Thread Madhusudhan Reddy
Hi All, I am trying to store the date with the timezone. for example, my servers are in Mumbai, when my servers are trying to get the time of America/Detroit. it is not able to get proper time Here is the snippet and details [image: Screenshot from 2023-08-16 08-00-21.png] def get_created_at

Re: Using activate() to set the timezone in Model Admin

2022-07-13 Thread Abdul Qoyyuum
Services HP: +673 720 8043 On Thu, Jul 14, 2022, 2:16 AM Paul Tiplady wrote: > I'd like to have my Admin site use a different default timezone than the > rest of my django app. > > I prefer the backend and API to operate in UTC, because this is a general > good practice for geogra

Using activate() to set the timezone in Model Admin

2022-07-13 Thread Paul Tiplady
I'd like to have my Admin site use a different default timezone than the rest of my django app. I prefer the backend and API to operate in UTC, because this is a general good practice for geographically distributed teams. However admin users (based in a specific timezone) find this conf

Re: Difference in datetime with timezone

2022-03-30 Thread Andrés Alvarez
"start_at", > "finish_at", > "has_individual_budget", > "card_provider_id", > "payment_provider_id" > ) > VALUES >

Re: Difference in datetime with timezone

2022-03-30 Thread Antonis Christofides
7;plan test create program start_at datetime\',                 \'0\',                 247,                 true, \'d6effacf-3c19-48db-ab06-5af1d97df599\', \'[{"id":239,"name":"Venezuela","iso_code2":"VE","iso_code3":"

Re: Difference in datetime with timezone

2022-03-29 Thread Andrés Alvarez
-ab06-5af1d97df599\', \'[{"id":239,"name":"Venezuela","iso_code2":"VE","iso_code3":"VEN","phone_prefix":58,"currency":"VEF","flag":"U+1F1FB U+1F1EA","phone

Re: Difference in datetime with timezone

2022-03-28 Thread Antonis Christofides
yment_provider_id") VALUES (\'plan test create program start_at datetime\', \'0\', 247, true, \'d6effacf-3c19-48db-ab06-5af1d97df599\', \'[{"id":239,"name":"Venezuela","iso_code2":"VE","iso_code3":

Difference in datetime with timezone

2022-03-28 Thread Andrés Alvarez
program start_at datetime\', \'0\', 247, true, \'d6effacf-3c19-48db-ab06-5af1d97df599\', \'[{"id":239,"name":"Venezuela","iso_code2":"VE","iso_code3":"VEN","phone_prefix":58,"curre

Re: Timezone UTC Problem

2021-02-17 Thread neha bhurke
Tysm Sir It is working Regards Neha On Wednesday, February 17, 2021 at 5:19:56 PM UTC+5:30 professional...@gmail.com wrote: > DATETIME_FORMAT = '%Y-%m-d %H:%M:%S' > > LANGUAGE_CODE = 'en-us' > > TIME_ZONE = 'Asia/Karachi' > > > USE_I18N = True > > USE_L10N = True > > USE_TZ = True > On We

Re: Timezone UTC Problem

2021-02-17 Thread Atif Usman
DATETIME_FORMAT = '%Y-%m-d %H:%M:%S' LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Asia/Karachi' USE_I18N = True USE_L10N = True USE_TZ = True On Wed, Feb 17, 2021 at 4:48 PM Omkar Parab wrote: > LANGUAGE_CODE = 'en-us' > > TIME_ZONE = 'Asia/Kolkata' > > USE_I18N = True > > USE_L10N = True > > USE_T

Re: Timezone UTC Problem

2021-02-17 Thread Omkar Parab
LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Asia/Kolkata' USE_I18N = True USE_L10N = True USE_TZ = True On Wed, Feb 17, 2021, 5:13 PM neha bhurke wrote: > How to set the Time zone in Setting.py > How to set UTC.. > > -- > You received this message because you are subscribed to the Google Groups >

Timezone UTC Problem

2021-02-17 Thread neha bhurke
How to set the Time zone in Setting.py How to set UTC.. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this

Understanding timezone with queryset day lookups

2020-06-09 Thread Ryan Causey
I ran into what I consider somewhat surprising behavior the other day when using the `__date` lookup to compare a datetime to a date in a queryset. It appears according to these docs that the Queryset will convert the datetime value in the DateTimeField to the current timezone before comparing

Re: timezone doesn't change

2020-05-08 Thread Andréas Kühne
the user you need to do this according to the documentation: https://docs.djangoproject.com/en/3.0/topics/i18n/timezones/ There is a lot of information there regarding handling timezones - but now() will always return a UTC (if timezone support is on :)) Regards, Andréas Den fre 8 maj 2020 kl 14

timezone doesn't change

2020-05-08 Thread mehrad nayeri
Hi, I'm using django 1.11.17 and I've changed TIME_ZONE in settings.py to 'Asia/Tehran' but django.utils.timezone.now() returns UTC time. How I have to fix it? Why it doesn't w

Re: How to set timezone in Django.

2019-07-10 Thread agent smith
Am Mittwoch, 10. Juli 2019 00:00:16 UTC+13 schrieb Paul Gureghian: > > Specifically in the official 'polls' tutorial from the docs. > > In the 'mysite.settings.py' file. I changed from 'UTC' to 'PST' and > 'pst' and both faulted. thanks. > -- You received this message because you are sub

Re: How to set timezone in Django.

2019-07-09 Thread Paul Gureghian
I used "America / Los_Angeles , and it worked. thanks On Tuesday, July 9, 2019 at 1:43:20 PM UTC-7, M. A wrote: > > 'PST' is not available in pytz > > The Pacific available timezones are : > > 'PST8PDT' > 'Pacific/Apia' > 'Pacific/Auckland' > 'Pacific/Bougainville' > 'Pacific/Chatham' > 'Pacific

Re: How to set timezone in Django.

2019-07-09 Thread M. A
'PST' is not available in pytz The Pacific available timezones are : 'PST8PDT' 'Pacific/Apia' 'Pacific/Auckland' 'Pacific/Bougainville' 'Pacific/Chatham' 'Pacific/Chuuk' 'Pacific/Easter' 'Pacific/Efate' 'Pacific/Enderbury' 'Pacific/Fakaofo' 'Pacific/Fiji' 'Pacific/Funafuti' 'Pacific/Galapagos' 'P

Re: How to set timezone in Django.

2019-07-09 Thread Mike Dewhirst
UTC is a unique timezone independent of any country. It is associated exclusively with zero degrees of longitude. It means universal constant time. You need to research the correct standard code for the timezone you are interested in. Connected by Motorola Paul Gureghian wrote

How to set timezone in Django.

2019-07-09 Thread Paul Gureghian
Specifically in the official 'polls' tutorial from the docs. In the 'mysite.settings.py' file. I changed from 'UTC' to 'PST' and 'pst' and both faulted. thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gro

Re: Django timezone problem

2019-02-08 Thread Mikko Meronen
Hi, But if I get the visitor's timezone using JS and send it to Django using AJAX and also do the changes below Alvaro suggested: from django.utils import timezone import pytz # Set user's timezone tzinfo = pytz.timezone(request.session['timezone']) #request.session[&#

Re: Django timezone problem

2019-02-08 Thread Perchouli
Hi Mikko, *t = timezone.now()* just get UTC timezone when USE_TZ=True. Modify as follows: tzinfo = pytz.timezone('end user's timezone') timezone.activate(tzinfo) t = timezone.localtime(timezone.now()) On Fri, Feb 8, 2019 at 12:50 PM Mikko Meronen wrote: > Hi A

Re: Django timezone problem

2019-02-08 Thread Josiah Jenson Nawaya
Hi, i believe what the system do with your timezone.now() function call is ton currently get the timezone of the location where your server is located. So if your hosting server is in England, it gets the server location timezone. U will need to first find a way to get the visitors location and

Re: Django timezone problem

2019-02-08 Thread Mikko Meronen
Hi Alvaro, If I do that (JS and AJAX), do you think my views.py is already correct? *T = timezone.now()* is important for me in order to get the right data from sql for the end user. *Views.py* from django.utils import timezone *t = timezone.now()* [this should detect end user's timezon

Re: Django timezone problem

2019-02-08 Thread Alvaro Chen
Set the timezone for the user via a property on the user is the best way. Otherwise, JS can detect the user's time zone. Use moment.js ( https://momentjs.com/timezone/docs/#/using-timezones/guessing-user-timezone/) or Intl ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe

Re: Django timezone problem

2019-02-06 Thread 'Amitesh Sahay' via Django users
appened in the history on this day(date). My view should be able to pick a right story from the database based on the users timezone. If Australian visits my webpage at this moment, he should be able to see what happened on February 5 in the past (it's already February 5 there). However he

Re: Django timezone problem

2019-02-06 Thread Thomas Lockhart
base > where is a story or stories what happened in the history on this day(date). > My view should be able to pick a right story from the database based on the > users timezone. If Australian visits my webpage at this moment, he should be > able to see what happened on February 5 in the

Re: Django timezone problem

2019-02-06 Thread Mikko Meronen
Hi, Thank you for your help :) -Mikko ke 6.2.2019 klo 18.47 Andréas Kühne kirjoitti: > Hi Mikko, > > The best way to do this is actually to set the timezone for the user via a > property on the user. The reason for this is that there is no way to > actually get the timezone f

Re: Django timezone problem

2019-02-06 Thread Andréas Kühne
Hi Mikko, The best way to do this is actually to set the timezone for the user via a property on the user. The reason for this is that there is no way to actually get the timezone from the browser (at least not completely correctly). That being said, if you want to go down that route - try

Re: Django timezone problem

2019-02-04 Thread Mikko Meronen
in the history on this day(date). My view should be able to pick a right story from the database based on the users timezone. If Australian visits my webpage at this moment, he should be able to see what happened on February 5 in the past (it's already February 5 there). However he sees what hap

Re: Django timezone problem

2019-02-04 Thread 'Amitesh Sahay' via Django users
Hello Mikko, There are basically two ways which I know . One is the timezone module that you are using another is datetime module. I believe that timezone module is more effective one.But instead of calling timezone.now() , call timezone.now. Or what is the exact issue are you facing? Regards

Re: Django timezone problem

2019-02-03 Thread Waqas Ali
solutions, but I get > quite confused. Below you will find my code. In short the code should show > a story on my webpage what happened in the past on the current day. However > it doesn't take into account the endusers local time, and thus doesn't work > properly. > > > *

Django timezone problem

2019-02-03 Thread Mikko Meronen
n the past on the current day. However it doesn't take into account the endusers local time, and thus doesn't work properly. *Views.py* from django.utils import timezone t = timezone.now() *[This should somehow react to endusers local time]* dm = t.strftime('%m-%d') history

Re: In my django web app i wannt show time in user timezone

2018-12-07 Thread Vovk Donets
them to build the time zone selection logic that makes sense for you." There is two paths. First. You can store time on the server in UTC, detect user timezone and then do conversion to this timezone on your backend. You can also look at https://docs.djangoproject.com/en/dev/topics/i18n/t

Re: In my django web app i wannt show time in user timezone

2018-12-07 Thread thanh . nguyenba0611
Hello, I think you can use "request.META" django. (request.META['TZ']). It is timezone user submit request. :D On Saturday, December 8, 2018 at 8:39:29 AM UTC+7, Deniz Bazan wrote: > > Hello everybody, > I have a django web app, in my app i want to show

In my django web app i wannt show time in user timezone

2018-12-07 Thread Deniz Bazan
Hello everybody, I have a django web app, in my app i want to show in the page where the time information is, with user timezone. I have a form with start_time and end_time(Timefield) user send this with a specific timezone(Berlin/Europa) after this when a user go to the page, the user should

DJANGO timezone.now is diffefent to datetime.now after we set the timezone config in setting.py

2018-01-18 Thread Lau Louis
Hi I am confused about the timezone setting. I have my OS timezone set to 'Asia/Shanghai', and my MYSQL/Mariadb is also using 'Asia/Shanghai' timezone. So i tried to configure the timezone in DJANGO settings.py LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Asia/S

Re: Converting Timezone-Naive Project to Timezone-Aware?

2018-01-05 Thread Jani Tiainen
rote: > Hi folks -- > > We have an existing project with dozens of DateTimeFields and hundreds of > millions of database records. It's an old codebase and timezone-naive; but > upcoming business needs require us to convert the project to be > timezone-aware. > > N

Converting Timezone-Naive Project to Timezone-Aware?

2018-01-05 Thread Noemi
Hi folks -- We have an existing project with dozens of DateTimeFields and hundreds of millions of database records. It's an old codebase and timezone-naive; but upcoming business needs require us to convert the project to be timezone-aware. Not only is this a big change, but it'

Re: Timezone error when I launch the admin login screen in 'Writing your first Django app'-tutorial

2017-09-26 Thread Dan Tagg
d. Please contact the administrator.' * > > and in the command prompt it says > > *'File > "C:\Users\lbl\Anaconda3\envs\reports\lib\site-packages\pytz\__init__.py", > line 181, in timezone raise UnknownTimeZoneError(zone) > pytz.exceptions.UnknownTimeZon

Timezone error when I launch the admin login screen in 'Writing your first Django app'-tutorial

2017-09-26 Thread Lise
een, I see a message that says *'A server error occurred. Please contact the administrator.' * and in the command prompt it says *'File "C:\Users\lbl\Anaconda3\envs\reports\lib\site-packages\pytz\__init__.py", line 181, in timezone raise UnknownTimeZoneError(zone) pyt

Re: Model with mix of timezone aware and naive datetimes?

2017-06-22 Thread Melvyn Sopacua
On Thursday 22 June 2017 15:19:18 Antonis Christofides wrote: > BTW, your decision to use a naive time for departure and arrival is > going to give you headaches unless you can be absolutely certain that > you will never have a departure or arrival that occurs during the > ambiguous hour during t

Re: Model with mix of timezone aware and naive datetimes?

2017-06-22 Thread Antonis Christofides
http://djangodeployment.com On 2017-06-22 05:49, Chris Beck wrote: > I a model that requires both timezone aware and naive datetimes. To be > specific, I am modelling a travel segment where the standard for departure and > arrival is to always use current local time, regardless of tz/dst/&

Re: Model with mix of timezone aware and naive datetimes?

2017-06-22 Thread Александр Христюхин (roboslone)
Why don't you store all your time as tz-aware and let views decide how to display them? > On 22 Jun 2017, at 05:49, Chris Beck wrote: > > I a model that requires both timezone aware and naive datetimes. To be > specific, I am modelling a travel segment where the standard for

Model with mix of timezone aware and naive datetimes?

2017-06-22 Thread Chris Beck
I a model that requires both timezone aware and naive datetimes. To be specific, I am modelling a travel segment where the standard for departure and arrival is to always use current local time, regardless of tz/dst/&c as well as an approved_on field that should have a tz. Is there anywa

Re: How do templates automatically convert dates to local timezone?

2016-08-04 Thread João Sampaio
You should probably look in the code of models.DateTimeField, models.DateField and models.TimeField. On Wed, Aug 3, 2016 at 6:06 PM, Robert Rollins wrote: > Perhaps I wasn't clear. I know *what* Django does with timezone-aware > dates. I just want to know *how* it does the conversi

Re: How do templates automatically convert dates to local timezone?

2016-08-03 Thread Robert Rollins
Perhaps I wasn't clear. I know *what* Django does with timezone-aware dates. I just want to know *how* it does the conversion from the UTC-stored datetime in the DB to the localtime-displayed datetime in the templates. Which function(s) does the template system call to do the conversion

Re: How do templates automatically convert dates to local timezone?

2016-08-03 Thread Constantine Covtushenko
Hi Robert, You have touched a very simple but always confusing questions - storing dates and showing them to users in different places. As I know Django uses that in very straightforward way. It always converts dates to UTC. Flow that converts them back to different users in different time-zones

How do templates automatically convert dates to local timezone?

2016-08-03 Thread Robert Rollins
I'm writing tests that assert dates are being properly rendered on a certain page, but the tests are failing because the date value on the model object is in UTC, and the date is rendered in local time on the template. I'd like to run that date value through the same mechanism by which the temp

Re: timezone application aware

2016-05-17 Thread David Alejandro Reyes Milian
I think this will really help you, worked a lot for me!! http://tommikaikkonen.github.io/timezones/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-user

Re: timezone application aware

2016-05-17 Thread Simon Charette
Hi Noumia, > Whatever operations they do within the database, all dates will be saved with > timezone, right? Django stores datetimes using the UTC timezone on all database backends. > But how do you identify the timezone of a user? is that something that I > should ask the user

Re: timezone application aware

2016-05-17 Thread Stephen J. Butler
I'm only experienced with the Oracle backend, but I believe only Postgres stores datetimes with timezone information. Otherwise, Django assumes all datetimes in the database are UTC. For the most portability you should assume that database values will be in UTC. The user's local t

timezone application aware

2016-05-17 Thread Noumia Ngangoum
Hi, how really work timezoned application? Let's stay I set my app to be used worldwide, which means I have user in america, in africa, in europe... Whatever operations they do within the database, all dates will be saved with timezone, right? But how do you identify the timezone of a

Re: Having trouble understanding Timezone

2016-01-07 Thread Ryan Causey
Thank you everyone for your responses. I believe I have a clear understanding of how it all interacts and what I need to do on my end. -Ryan Causey -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivi

Re: Having trouble understanding Timezone

2016-01-07 Thread Juan Miguel Paredes
mplates and forms." Does this mean that the TIME_ZONE setting in > settings.py should be UTC? Or should it be the timezone in which the > database server is located? > The particular needs of your project should determine how to configure Django and your database server. Since you'

Re: Having trouble understanding Timezone

2016-01-06 Thread Mike Dewhirst
e the date/time saved is ... 2016-01-07 18:23:53.710608+11 There is enough information there to represent a UTC time. Simply subtract 11 hours. Then add whatever for another timezone. I don't know if the Django framework does that automatically based on the client system time but I'm not

Re: Having trouble understanding Timezone

2016-01-06 Thread Avraham Serour
1. you don't need to st the TIME_ZONE setting, leave at default 2. honestly I don't know how setting the timezone in postgres influences the data, but I believe it doesn't need to be in sync with django settings. 3. yes, this is a good recommendation success Avraham On Thu, Jan

Having trouble understanding Timezone

2016-01-06 Thread Ryan Causey
s mean that the TIME_ZONE setting in settings.py should be UTC? Or should it be the timezone in which the database server is located? 2. I am using a postgresql database, and the installation defaulted the database's timezone to my local one. In support of Django storing all

Re: Timezone import error

2015-11-30 Thread ahmed . abdullah . bh
traceback you are sending is not > concluyent. > > 2015-11-29 15:11 GMT+00:00 >: > >> Hi, >> >> I'm practicing Django v 1.8.6 (Writing your first Django app, part 1) and >> getting error when trying to import timezone, also I have installed pytz, >>

Re: Timezone import error

2015-11-29 Thread monoBOT
> I'm practicing Django v 1.8.6 (Writing your first Django app, part 1) and > getting error when trying to import timezone, also I have installed pytz, > when I try to use the import timezone package I'm getting ImportError. > > My settings.py has USE_TZ set to true by defau

Re: Timezone import error

2015-11-29 Thread knbk
Hi, > > I'm practicing Django v 1.8.6 (Writing your first Django app, part 1) and > getting error when trying to import timezone, also I have installed pytz, > when I try to use the import timezone package I'm getting ImportError. > > My settings.py has USE_TZ set to true b

Timezone import error

2015-11-29 Thread ahmed . abdullah . bh
Hi, I'm practicing Django v 1.8.6 (Writing your first Django app, part 1) and getting error when trying to import timezone, also I have installed pytz, when I try to use the import timezone package I'm getting ImportError. My settings.py has USE_TZ set to true by default, also

Re: TIMEZONE

2015-04-08 Thread Luis Zárate
Other thing that I forgot in the last mail is how use function now() Wrong solution from datetime import datetime datetime.now() Good solution from django.utils import timezone timezone.now() 2015-04-08 10:16 GMT-06:00 Luis Zárate : > Do you have installed pytz ? Django use it w

Re: TIMEZONE

2015-04-08 Thread Luis Zárate
e was having time zone as >> >> TIME_ZONE = 'America/Chicago' >> >> now i have changed to >> TIME_ZONE = 'Europe/London' >> >> that not getting reflected means date and time are getting stored in >> database as of previous timezone.

Re: TIMEZONE

2015-04-08 Thread Olalla Galiñanes Feijoo
akash...@ranosys.com escribió: > > Hi to all , > > Previously my settings.py file was having time zone as > > TIME_ZONE = 'America/Chicago' > > now i have changed to > TIME_ZONE = 'Europe/London' > > that not getting reflected means date and tim

Re: TIMEZONE

2015-04-08 Thread Jirka Vejrazka
Hello there, you probably need to take a look at the USE_TZ setting too. If it's True, then Django will store all times in the UTC timezone and only use the one you configured in views and templates (and a few other places). In most cases, that's what you want anyway as it&

TIMEZONE

2015-04-08 Thread akash . patni
Hi to all , Previously my settings.py file was having time zone as TIME_ZONE = 'America/Chicago' now i have changed to TIME_ZONE = 'Europe/London' that not getting reflected means date and time are getting stored in database as of previous timezone... Please suggest. -

Re: django custom timezone middleware causing django.contrib.humanize test to fail

2015-03-31 Thread Tim Graham
get all tests to pass with Django 1.5.4 when I have > custom timezone-activating middleware enabled. > > I've posted code here: http://stackoverflow.com/questions/29376612 > > Is there a way to disable the middleware for that specific test? > -- You received this messag

django custom timezone middleware causing django.contrib.humanize test to fail

2015-03-31 Thread Matt Ball
Hi -- I'm unable to get all tests to pass with Django 1.5.4 when I have custom timezone-activating middleware enabled. I've posted code here: http://stackoverflow.com/questions/29376612 Is there a way to disable the middleware for that specific test? -- You received this message b

Re: Local timezone in django admin

2014-12-09 Thread Collin Anderson
Hi Vamsy, What database are you using? Collin On Monday, December 8, 2014 4:35:46 AM UTC-5, vamsy krishna wrote: > > Hi, > > The default timezone in our application is UTC (stored in the database). > However I would like to display the datetime fields on the admin interface

Local timezone in django admin

2014-12-08 Thread vamsy krishna
Hi, The default timezone in our application is UTC (stored in the database). However I would like to display the datetime fields on the admin interface based on the user's local timezone. We're using Django 1.6. Thanks, Vamsy -- You received this message because you are subscri

Loading timezone naive data into your test database with USE_TZ = True

2014-09-17 Thread Robert Rollins
I have a legacy database from which my Django application must migrate data into a Django database. The relevant date fields are actually TIMESTAMP columns in the database, but something (perhaps Django, or python's MySQL driver?) loads these columns as timezone naive datetime objects, r

Re: Feeling some serious timezone pain

2014-08-21 Thread Subodh Nijsure
You could consider passing the timestamp in UTC to the template and then convert it to browser's timezone using javascript function - convertUTCDateToLocalDate(data)? -Subodh On Wed, Aug 20, 2014 at 5:22 AM, christophw wrote: > Hi there, > > I'm feeling some pain while wrang

Re: Feeling some serious timezone pain

2014-08-21 Thread Tom Evans
On Wed, Aug 20, 2014 at 1:22 PM, christophw wrote: > Hi there, > > I'm feeling some pain while wrangling with timezones in an office room > booking application. I'm storing bookings in a MySQL database and want to > display them in the timezone local to the

Re: Feeling some serious timezone pain

2014-08-21 Thread Geoffrey S. Knauth
the > date was in August, and Toronto is presumably 4 hours behind of UTC in > August (haven't checked). But your tamplate renders the correct datetime > wrong?So the template must be doing the wrong thing. > > Can you show your settings.py timezone values? And the template

Re: Feeling some serious timezone pain

2014-08-21 Thread Erik Cederstrand
ed, because you POST'ed 12:00 Toronto time, and the date was in August, and Toronto is presumably 4 hours behind of UTC in August (haven't checked). But your tamplate renders the correct datetime wrong?So the template must be doing the wrong thing. Can you show your settings.py tim

Re: Feeling some serious timezone pain

2014-08-20 Thread Chris Whiten
I can understand that sentiment... But that doesn't change the fact that 12:00 PM on the Python side renders as 11 AM in the template, right? On Wednesday, 20 August 2014 09:09:24 UTC-4, Erik Cederstrand wrote: > > > Den 20/08/2014 kl. 14.22 skrev christophw >: > > > When the booking is stored,

Re: Feeling some serious timezone pain

2014-08-20 Thread Erik Cederstrand
Den 20/08/2014 kl. 14.22 skrev christophw : > When the booking is stored, it comes back from a post and I store it in the > DB as such: > > dt = datetime.datetime.strptime(request.POST["date"] + " " + > request.POST["time"], "%Y-%m-%d %H:%M") > dt = pytz.timezone("America/Toronto").localize(dt

Re: Feeling some serious timezone pain

2014-08-20 Thread Chris Whiten
be you were expecting the timezone to be > -05:00? That would be standard time (winter). Daylight savings time is > -04:00. > -- > Geoffrey S. Knauth | http://knauth.org/gsk > > On Wed, Aug 20, 2014, at 08:22, christophw wrote: > > Hi there, > > I'm feelin

Re: Feeling some serious timezone pain

2014-08-20 Thread Robin
GMT with the current time in Britain, after any adjustment for summer time. Robin St.Clair On 20/08/2014 13:32, Geoffrey S. Knauth wrote: |2014-08-30 16:00:00+00:00 GMT| |2014-08-30 12:00:00-04:00Toronto (Summer)| || ||This looks correct to me. Maybe you were expecting the timezone to be -05

Re: Feeling some serious timezone pain

2014-08-20 Thread Geoffrey S. Knauth
2014-08-30 16:00:00+00:00 GMT 2014-08-30 12:00:00-04:00 Toronto (Summer) This looks correct to me. Maybe you were expecting the timezone to be -05:00? That would be standard time (winter). Daylight savings time is -04:00. -- Geoffrey S. Knauth | [1]http://knauth.org/gsk On Wed, Aug 20, 2014

Feeling some serious timezone pain

2014-08-20 Thread christophw
Hi there, I'm feeling some pain while wrangling with timezones in an office room booking application. I'm storing bookings in a MySQL database and want to display them in the timezone local to the office room, so it is not necessarily local to the user's local machine timezone

Django - Mysql datetime timezone naive and aware

2014-05-23 Thread Gabriel
Hello folks, I've found an abnormal behavior migrating a project from php - mysql to django 1.6.x - mysql and timezone naive to aware datetimes, I've posted my insights about it in stack overflow, if anyone can help will be more than welcome! Many thanks! Stackoverflow lin

Re: Client side timestamp handling and timezone

2014-03-27 Thread Aaron Cannon
timestamp back to a valid datetime > object, by means of: > > datetime.datetime.fromtimestamp(int(self.request_data.get(TIME_OF_PICKUP_FIELD))) > > but the function fromtimestamp is also applying the timezone conversation to > the provide value which turns the datetime one hour ahead/behind the user&#

Client side timestamp handling and timezone

2014-03-18 Thread Yoanis Gil Delgado
mpts to convert this timestamp back to a valid datetime object, by means of: datetime.datetime.fromtimestamp(int(self.request_data.get(TIME_OF_PICKUP_FIELD))) but the function fromtimestamp is also applying the timezone conversation to the provide value which turns the datetime one hour ahead/be

Re: remove timezone support from one app

2014-01-13 Thread smcoll
What i wound up doing was to create a custom ModelField which deals with timezone-naive datetimes/timestamps: https://gist.github.com/smcoll/8405914 Then, i created schema/data migrations in South to convert existing values. On Saturday, January 11, 2014 11:05:54 AM UTC-6, smcoll wrote: > &

Re: remove timezone support from one app

2014-01-11 Thread smcoll
To clarify, i'm dealing with datetimes which pre-date the implementation of timezones (solar time). So i'd like any admin user in any timezone to be able to enter a naive datetime which will remain the same naive datetime for any usage in the site. On Saturday, January 11, 2014 1

remove timezone support from one app

2014-01-11 Thread smcoll
i have timezone support enabled for my project, but there is one application which i would like to behave as timezone-naive. How can this be accomplished? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

How to add timezone support in Django (1.5) admin

2013-11-26 Thread Carlos Villavicencio
I am using django 1.5 with pytz. Currently all the datetimes stored in the database are in UTC. The frontend application is timezone aware (users worldwide), that means that I store the user timezone in his profile. Administration is using the default timezone as in settings.py (UTC). What

Re: Import Error: cannot import name timezone

2013-08-25 Thread Robin Lery
Good to hear that! On Sun, Aug 25, 2013 at 7:19 AM, Patrick Larmann wrote: > Thanks fixed it? > > > On Saturday, August 24, 2013 5:45:47 PM UTC-4, Robin Lery wrote: > >> It should be >> 'from django.utils import timezone' >> and not >> '

Re: Import Error: cannot import name timezone

2013-08-24 Thread Patrick Larmann
Thanks fixed it? On Saturday, August 24, 2013 5:45:47 PM UTC-4, Robin Lery wrote: > > It should be > 'from django.utils import timezone' > and not > 'from django.db.utils import timezone' > > > On Sun, Aug 25, 2013 at 2:58 AM, Patrick Larmann &

Re: Import Error: cannot import name timezone

2013-08-24 Thread Robin Lery
It should be 'from django.utils import timezone' and not 'from django.db.utils import timezone' On Sun, Aug 25, 2013 at 2:58 AM, Patrick Larmann wrote: > He Guys, > I am currently completing part 1 of the django tutorial and having trouble > with getting on of the

Getting Timezone conversion in template with USE_TZ = False;

2013-08-12 Thread Lee Hinde
I'm displaying a date/time field in template. Data in the database: 2013-05-30 00:00:00 template tag: {{ reg.registration_date }} as displayed in the web page: May 29, 2013, 5 p.m. I didn't have a USE_TZ setting until I tried to figure out what was happening here. The data I'm playing with no

Re: pub_date timezone

2012-10-27 Thread Brendan Carroll
t; >> Hi erm >> >> Went back over your comment and realised what you commented. >> After python manage.py I gget the python prompt>>> and then typed >> from polls.models import Poll, Choice >> >> then I typed: Poll.objects.all() and got the array brace

Re: pub_date timezone

2012-10-26 Thread donarb
;>> and then typed > from polls.models import Poll, Choice > > then I typed: Poll.objects.all() and got the array brace [] returned. > then I typed from django.utils import timezone > > then typed: p = Poll(question="Whats new?", pub_date=timezone.now(

  1   2   >