I am facing problem in my django app while working with DateTimeField
.Its mainly because of DST time changes.
I have created an event on 30-oct-2015(DST last week). I created a copy of first event which will be on 06-Nov-2015(Non DST day)
I applied timedelta
of 7 days , So it chaned days to 7+. But I did not aplly timedelta for hours.
Due to Day Light saving , its reduced by one hour. I dont need this. I just want to have same hours. How Can I do that.?
I tried with this , but did not help me.
DST timezone issue in django app
Please see this screenshot
my models.py
from django.db import models
from datetime import timedelta
class Event(models.Model):
name = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
start_date = models.DateTimeField()
def __unicode__(self):
return self.name
def copy_event(self, add_days=timedelta(days=7)):
start_date = self.start_date + add_days
name = self.name +' (copy)'
new_event = Event(name = name,created = self.created,start_date=start_date,)
new_event.save()
return new_event