0

I am currently using Zend framework 3 with zend log module. I noticed the Timestamp column of zend log table is not unix timestamp.

I have tried to search solution but all I could see the way to change format. It there a way to change it and store to unix timestamp?

Ali Rasheed
  • 2,765
  • 2
  • 18
  • 31

1 Answers1

0

You can set your prefered time using setDateTimeFormat() to Formatter, as in below-

    $logger = new \Zend\Log\Logger();

    $formatter = new \Zend\Log\Formatter\Simple();
    $formatter->setDateTimeFormat('Y-m-d'); // as per your choice

    $writer = new \Zend\Log\Writer\Stream('php://output');
    $writer->setFormatter($formatter);
    $logger->addWriter($writer);
Gautam Rai
  • 2,445
  • 2
  • 21
  • 31