-1

Hello there :) I am basically trying to pull data from a MySQL table, and with it I need the PHP to get the current time on the server as well. So E.G. if it is currently 16-12-2015 and 20:50:36, i need this time to then be converted to unix (which is done with strtotime()).

My question is, how do I get the time of the server in unix put into a $variable?

Thank you,

Joshua

2 Answers2

2
$variable = time();

should do what you're looking for.

1

Since you are mentioning MySQL, do you want to know how to add this to your query? That would be done like this:

SELECT UNIX_TIMESTAMP() AS timestamp ...
miken32
  • 42,008
  • 16
  • 111
  • 154