Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First things first</p> <pre><code> echo "&lt;td&gt;&lt;strong&gt; ("d/m/y",". $row['date'] .")&lt;/strong&gt;&lt;/td&gt;"; </code></pre> <p>This line looks wrong; I suspect it ought to read something like</p> <pre><code> echo "&lt;td&gt;&lt;strong&gt;" . date( "d/m/y", $row['date'] ) . "&lt;/strong&gt;&lt;/td&gt;"; </code></pre> <p>Note the missing function call and concatenation operators. Incidentally, while this is syntactically correct (so far as I can see), it may not do what you're looking for, depending upon what <code>$row['date']</code> actually contains - it needs to be a Unix timestamp for <code>date()</code> to grok it properly.</p> <p>To obtain the date as a Unix timestamp, you can use the MySQL function <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp" rel="nofollow noreferrer"><code>UNIX_TIMESTAMP()</code></a> when selecting the date, e.g.</p> <pre><code>SELECT *, UNIX_TIMESTAMP(date) AS date_ts FROM ... </code></pre> <p>You can then access <code>$row['date_ts']</code> as normal, and pass it into the <code>date()</code> function for formatting. Alternatively, you can use something like <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp" rel="nofollow noreferrer"><code>strtotime()</code></a> to parse the current value being returned in order to get a timestamp from that.</p> <p>A further alternative is to have MySQL format the date on your behalf, using its <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format" rel="nofollow noreferrer"><code>DATE_FORMAT()</code></a> function; again, you can access this value returned from the query and print it out.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload