Tutorial : How to add date and time using php


Read {count} times since 2020

You might want to add date and time using php in your php files. I will tell you how to do it.

1 – Go to your PHP page. Paste this code where you want to add date and time
   

       date("J-F- Y–H:I A")

This code will Show date and time in Date-Month-Year –Hour:Minute:AM/PM
If you want to change the type of showing date and time just change the position of the letters.
Here is a list of dates you can use in PHP

  <td width="50%">
    Date types
  </td>
</tr>

<tr valign="TOP">
  <td height="114" width="50%">
    J<br />F<br />Y<br />H<br />I<br />S<br />A
  </td>
  
  <td width="50%">
    Date<br />Month<br />Year<br />Hour<br />Minutes<br />Seconds<br />AM/PM
  </td>
</tr>
Functions

       

Show Comments