date() expects parameter 2 to be integer, string given - Help Me
<p>My Laravel 5.2 code is </p>

<pre><code>$this-&gt;timestamp=date('Y-m-d',intval($timestamp));
$datetime=date('Y/m/d', $timestamp);
</code></pre>

<blockquote>
  <p><strong><em>date() expects parameter 2 to be integer, string given</em></strong></p>
</blockquote>

<p>That error occur. But that error show when choose the day 31, not on other days (1 to 30). The other days are ok.</p>

<p>When I change my code like that</p>

<pre><code>$this-&gt;timestamp=date('Y-m-d',intval($timestamp));
$datetime=date('Y/m/d', intval($timestamp));
</code></pre>

<p>Error solved but the date show is not correct. The date always show <strong><em>1970/01/01</em></strong>
Please help me, how to fix this?</p>