使用输入类型=“日期类型”。HTML中使用<input type =“ datetime-local”>来使用datetime输入类型。使用此功能,允许用户选择日期和时间。只要单击输入字段,就会显示日期时间选择器弹出窗口。
<!DOCTYPE html> <html> <head> <title>HTML input datetime</title> </head> <body> <form action = "" method = "get"> Details:<br><br> Student Name<br><input type = "name" name = "sname"><br> Exam Date and Time<br><input type = "datetime-local" name = "datetime"><br> <input type = "submit" value = "Submit"> </form> </body> </html>