Difference between datetime and datetime-local in HTML5

JavascriptWeb DevelopmentFront End Scripts

datetime

A date and time (year, month, day, hour, minute, second, fractions of a second) encoded according to ISO 8601 with the time zone set to UTC.

Let us see an example:

<!DOCTYPE HTML>
<html>
   <body>
      <form action = "/cgi-bin/html5.cgi" method = "get">
         Date and Time : <input type = "datetime" name = "newinput" />
         <input type = "submit" value = "submit" />
      </form>
   </body>
</html>

datetime-local

A date and time (year, month, day, hour, minute, second, fractions of a second) encoded according to ISO 8601, with no time zone information.

Let us see an example:

<!DOCTYPE HTML>
<html>
   <body>
      <form action = "/cgi-bin/html5.cgi" method = "get">
         Local Date and Time : <input type = "datetime-local" name = "newinput" />
         <input type = "submit" value = "submit" />
      </form>
   </body>
</html>
raja
Published on 10-Apr-2018 12:52:51
Advertisements