2
mon modèledatetime django timestamp unix
create = models.DateTimeField(auto_now_add=True)
comment obtenir le temps unix de ce champ?
datetime.datetime.timestamp()
mais j'ai besoin int
mon modèledatetime django timestamp unix
create = models.DateTimeField(auto_now_add=True)
comment obtenir le temps unix de ce champ?
datetime.datetime.timestamp()
mais j'ai besoin int
créer Voici un simple python datetime.datetime instance elle-même.
Pour python moins 2.x
Vous pouvez le faire.
my_model = MyModel()
int(my_model.create.strftime('%s'))
Pour python 3.3+
Vous pouvez juste faire
my_model = MyModel()
my_model.create.timestamp()