Posted By

visionlighter on 03/17/12


Tagged

php time microtime timestamp epoch time-utility


Versions (?)

[PHP] simpletimes function


 / Published in: PHP
 

URL: snipplr.com/simpletimes

A useful function for different formats of time or if you are dealing with time in PHP code.

  1. define('DATE_FORMAT', 'Y-m-d H:i:s');
  2. function simpletimes() {
  3. $time['timestamp'] = time();
  4. $time['micro_time'] = microtime();
  5. $time['date_time'] = date(DATE_FORMAT,$time['timestamp']);
  6. $time['unix_time'] = strtotime($time['date_time']);
  7. $time['hash_time'] = md5($time['unix_time']);
  8. return $time;
  9. }

Report this snippet  

You need to login to post a comment.