jQuery Mobile - Textinput Datetime

Descripción

datetimeEl atributo de tipo en la entrada define el control de fecha y hora. La fecha y la hora (año, mes, día, hora, minuto, segundo, fracciones de segundo) se codifican de acuerdo con ISO 8601 con la zona horaria establecida en UTC.

Ejemplo

El siguiente ejemplo demuestra el uso de la entrada de fecha y hora en jQuery Mobile.

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>
   
   <body>
      <form>
         <h2>Datetime Input Example</h2>
         <label for = "src">Datetime Input</label>
         <input type = "datetime" id = "src" data-clear-btn = "false">

         <label for = "src1">Clear the Datetime Field</label>
         <input type = "datetime" data-clear-btn = "true" id = "src1">

         <label for = "src2">Datetime Local Input</label>
         <input type = "datetime-local" id = "src2" data-clear-btn = "false">

         <label for = "src3">Clear the Datetime Local Field</label>
         <input type = "datetime-local" data-clear-btn = "true" id = "src3">
      </form>
   </body>
</html>

Salida

Realicemos los siguientes pasos para ver cómo funciona el código anterior:

  • Guarde el código html anterior como textinput_datetime.html archivo en la carpeta raíz de su servidor.

  • Abra este archivo HTML como http: //localhost/textinput_datetime.html y se mostrará el siguiente resultado.