PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
Line 2: Line 2:


== time / timestamp ==
== time / timestamp ==
Convert '''unix timestamp''' (the number of seconds since 1970/01/01) <--> to the '''human readable time''' format
=== terms of time format ===
<table border="1">
<tr>
  <td> format \ date </td>
  <td> 1900/1/1</td>
  <td> 1970/1/1</td>
  <td> 2016/1/1 </td>
</tr>
<tr>
  <td> column value of Excel DATEVALUE function <br />  (number of days since 1900/1/1) </td>
  <td> 1</td>
  <td> 25569</td>
  <td> 42370</td>
</tr>
<tr>
  <td> column value of unix timestamp <br /> (the number of seconds since 1970/01/01)</td>
  <td> -2209075200</td>
  <td> 0</td>
  <td> 1451606400</td>
</tr>
</table>
=== now ===
=== now ===
the '''human readable''' time format ex: {{Template:Today}} {{CURRENTTIME}}:06
Convert '''unix timestamp''' (the number of seconds since 1970/01/01) <--> to the '''human readable''' time format ex: {{Template:Today}} {{CURRENTTIME}}:06
* php: echo date("Y-m-d H:i:s", time() ); //Convert the time stamp of current time to the human readable time format. Ex: return '{{Template:Today}} {{CURRENTTIME}}:06'
* php: echo date("Y-m-d H:i:s", time() ); //Convert the time stamp of current time to the human readable time format. Ex: return '{{Template:Today}} {{CURRENTTIME}}:06'
* mysql:  
* mysql:  

Navigation menu