Display today's date in HTML

ananias8686 Posted messages 96 Status Member -  
SioGabx Posted messages 260 Registration date   Status Member Last intervention   -

<input type="date" name="date" value="&lt;?php echo date('Y-m-d'); ?&gt;" />

1 answer

  1. SioGabx Posted messages 260 Registration date   Status Member Last intervention   100
     
    Method 1: With Javascript:
     <input id="Today" type="date" name="date" value="" readonly> <script> document.getElementById("Today").valueAsDate = new Date(); </script> 


    Method 2: With PHP:
    <input type="date" value="<?php echo date('Y-m-d'); ?>">


    8