I'm trying to convert a datetime object to a UNIX timestamp (preferably in milliseconds, though I wouldn't mind with and without).
Mktime seems to be the method that usually gets it, however I keep getting the error:
AttributeError: type object 'datetime.time' has no attribute 'mktime'.
Can anyone tell me what I'm doing wrong? I keep going round in circles!
Actually, even using the above answer, I still got the same error message.
I´ve solved my problem using
I don't know the why, but, it only worked using the alias (as mktime)... can somebody tell me the reason ...
I think you have done
instead of
so that the object called
time
is actually coming from the datetime module, not the time module.