python function to return javascript date.getTime()
问题 I'm attempting to create a simple python function which will return the same value as javascript new Date().getTime() method. As written here, javascript getTime() method returns number of milliseconds from 1/1/1970 So I simply wrote this python function: def jsGetTime(dtime): diff = datetime.datetime(1970,1,1) return (dtime-diff).total_seconds()*1000 while the parameter dtime is a python datetime object. yet I get wrong result. what is the problem with my calculation? 回答1: One thing I feel