Converting TIMESTAMP to unix time in PHP?
问题 Currently I store the time in my database like so: 2010-05-17 19:13:37 However, I need to compare two times, and I feel it would be easier to do if it were a unix timestamp such as 1274119041 . (These two times are different) So how could I convert the timestamp to unix timestamp? Is there a simple php function for it? 回答1: You're looking for strtotime() 回答2: You want strtotime: print strtotime('2010-05-17 19:13:37'); // => 1274123617 回答3: Getting a unixtimestamp: $unixTimestamp = time();