How to convert from date to unix_timestamp using javascript
问题 I have a time string in the following format YYYY-MM-DD hh:mm:ss . I would like to convert it to the equivalent of passing the date-string into the mysql unix_timestamp function using Javascript. I tried parsing the date and passing it into the Date.UTC() function but it seems to be giving me different times then what I want. help. 回答1: If you are supplying a UTC timestamp and want seconds since 1/1/1970, then: [...] Edit Revisited my original answer and didn't like it, the following is