time.time() gives current time in seconds from a given reference. Is there a mean to convert a date to a number of seconds since given reference?
I thought of calendar.timegm(), but I am not sure how to format the argument.
thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
calendar.timegmis the good approach. Just pass it theutctimetuple()output from your datetime object:prints
just to test it against the epoch:
prints
0.