johnny wrote:
> My model named: Post
>
> It has a field created_at as:
> created_at = models.DateTimeField(auto_now_add = True)
>
> Would Post.created_at be of string or datetime ?
>
> I want to add 2 weeks to it, like Post.created_at + 14 days. Can I do
> this?
> Post.created_at =Post.created
I'd suggest:
from datetime import datetime, timedelta
p = Post() # create an instance of Post
# p.created_at should now be a datetime-object to python
p.created_at + timedelta(weeks=2)# will also be a datetime object
see also: http://docs.python.org/lib/module-datetime.html
--~--~
2 matches
Mail list logo