xxxxxxxxxx
<input type="datetime-local" id="date-time-input">
xxxxxxxxxx
<label for="start">Start date:</label>
<input type="date" id="start" name="trip-start"
value="2018-07-22"
min="2018-01-01" max="2018-12-31">
xxxxxxxxxx
<input type="datetime-local" name="" id="">
//Incase you need to add both date and time
<input type="time" name="" id="">
//For just time
xxxxxxxxxx
<label for="datetime">Select Date and Time:</label>
<input type="datetime-local" id="datetime" name="datetime">
xxxxxxxxxx
<input type="time" id="meeting-time" name="meeting-time" min="09:00" max="18:00" required>
xxxxxxxxxx
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Current Date and Time is <span id='date-time'></span>.</p>
</body>
</html>
xxxxxxxxxx
<form>
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday">
</form>
xxxxxxxxxx
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="datePicker" type="date" />
Run code snippet
xxxxxxxxxx
// convert Javascript Date to HTML Input
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var hour = ("0" + (now.getHours())).slice(-2);
var min = ("0" + (now.getMinutes())).slice(-2);
var today = now.getFullYear() + "-" + month + "-" + day + "T" + hour + ":" + min;
xxxxxxxxxx
from datetime import datetime
# Ask user for date and time inputs
date_input = input("Enter a date (YYYY-MM-DD): ")
time_input = input("Enter a time (HH:MM:SS): ")
# Format the date and time inputs into a datetime object
datetime_input = datetime.strptime(date_input + " " + time_input, "%Y-%m-%d %H:%M:%S")
# Print the datetime object
print("Input datetime:", datetime_input)