开发者

Add 2 hours and 1 day onto a timestamp in django

i have a model which holds data for a game, how would i add 2 hours and 1 day onto the开发者_运维问答 'starts' field?

class Game(models.Model):
    starts = models.DateTimeField(auto_now_add=True)
    ends = models.DateTimeField()

does anyone have a solution for this?


from datetime import timedelta
obj.starts += timedelta(days=1, hours=2)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜