I can not understand the error when formatting the date. Please tell me why in this code I get: 1970-01-01

strftime("%Y-%m-%d 00:00:00", date("Ym-01")) 

Instead of getting 2017-10-04 00:00:00

  • one
    почему в таком коде я получаю: 1970-01-01 - Because strftime takes strtotime , not date , apparently - Alexei Shimansky
  • Similarly, thank you !! - WhoIsDT
  • @PauloBerezini In fact, anyone can issue an answer, even you can calmly, if you like, refer to the comments and write. And even the author of the question. But ok, designed)) - Alexey Shimansky
  • @ Alexey Shimansky, it's a shame to take someone else's answer a little) - Paulo Berezini

1 answer 1

Judging by the documentation, strftime looks like this:

 string strftime ( string $format [, int $timestamp = time() ] ) 

This means that it is necessary to transfer not the date , but strtotime