Converting TIMESTAMP to unix time in PHP?

Rob picture Rob · May 17, 2010 · Viewed 67.7k times · Source

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?

Answer

Mark picture Mark · May 17, 2010

You're looking for strtotime()