If you only want the date portion, use type="date":

<input type="date" name="book_date" id="book_date"
       onchange="console.log(this.value);" />

If you really want to use type="datetime-local", you can simply split the value by T:

<input type="datetime-local" name="book_date" id="book_date"
       onchange="console.log(this.value.split('T')[0]);" />

Answer from Racil Hilan on Stack Overflow
🌐
EyeHunts
tutorial.eyehunts.com › home › javascript get a date without time | display example
Javascript get a date without time | Display Example - EyeHunts
May 15, 2021 - See below example of display date without time or remove time from date object. <!DOCTYPE html> <html> <body> <script> var d = new Date(); var NoTimeDate = d.getFullYear()+'/'+(d.getMonth()+1)+'/'+d.getDate(); alert(NoTimeDate); </script> </body> ...
Discussions

c# - Display only date and no time - Stack Overflow
I am using HTML.EditorFor(model => model.Returndate) how do I format the display in this case... 2011-08-19T16:31:10.467Z+00:00 ... That was just an example of how to format your result; I'll update my answer. 2011-08-19T16:34:27.833Z+00:00 ... I think if the value is logically only a date, it's worth storing just the date part as well, even if the time ... More on stackoverflow.com
🌐 stackoverflow.com
c# - ASP.NET MVC displaying date without time - Stack Overflow
The problem is that the date is displayed together with its time value. I wonder why it does not take DateType attribute into consideration and displays only the date value without time. I know that I may create a display template for DateTime but in other cases than date of birth I want to ... More on stackoverflow.com
🌐 stackoverflow.com
html - How to display date as mm/dd/yyyy without time in React.js - Stack Overflow
I can't get my date to display without the time in an HTML table. This is my code. {call.date} The date gets entered by a Date Picker as mm/dd/yyyy but us More on stackoverflow.com
🌐 stackoverflow.com
css - Display the current date and time using HTML and Javascript with scrollable effects in hta application - Stack Overflow
I have the below java-script to display the current date in the given format Mon Jun 2 17:54:28 UTC+0530 2014 in a hta(html application), now I want to make this appear in a way like Welcome the cu... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Quora
quora.com › Is-it-possible-to-show-the-current-time-on-an-HTML-page-without-using-JavaScript
Is it possible to show the current time on an HTML page without using JavaScript? - Quora
We have to use JavaScript for it. We can use Date() constructor in JavaScript to create date objects. ... If we don't pass any argument in Date(), it return us current date and time .Like Mon Jul 27 2020 20:20:46 GMT+0530 (India Standard Time).
🌐
W3Schools
w3schools.com › tags › att_time_datetime.asp
HTML time datetime Attribute
Dates: <time datetime="1914"> <!-- means the year 1914 --> <time datetime="1914-12"> <!-- means December 1914 --> <time datetime="1914-12-20"> <!-- means 20 December 1914 --> <time datetime="12-20"> <!-- means 20 December any year --> <time datetime="1914-W15"> <!-- means week 15 of year 1914 --> Date and Times: <time datetime="1914-12-20T08:00"> <!-- means 20 December 1914 at 8am --> <time datetime="1914-12-20 08:00"> <!-- also means 20 December 1914 at 8am --> <time datetime="1914-12-20 08:30:45"> <!-- with minutes and seconds --> <time datetime="1914-12-20 08:30:45.687"> <!-- with minutes,
Find elsewhere
🌐
Quora
quora.com › How-can-I-display-the-current-date-in-an-HTML-form
How to display the current date in an HTML form - Quora
Choose the snippet matching the ... (2022–present) · Author has 61 answers and 296.2K answer views · 5y · We can't display the current date directly from HTML....
🌐
Arclab
arclab.de › kb › htmlcss › display-date-time-javascript-php-ssi.html
Display Date and Time on a Webpage (javascript, php, SSI)
Important: This code will display the date/time on the server and works only if your webpage has the extension .php! If you want to show the client-side date, use javascript (see above) instead. <!doctype html> <html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body> <p>Date/Time: MM/DD/YYYY hh:mm<br> <?php echo(strftime("%m/%d/%Y %H:%M")); ?></p> <p>Date/Time: DD.MM.YYYY hh:mm (German)<br> <?php echo(strftime("%d.%m.%Y %H:%M")); ?></p> </body> </html>
🌐
Reddit
reddit.com › r/askprogramming › what's are best practices when dealing with dates, without time-of-day?
r/AskProgramming on Reddit: What's are best practices when dealing with dates, without time-of-day?
May 19, 2022 -

What is best practice when dealing with date values without time, in JavaScript? My concern is subtle off-by-one bugs caused by local Time Zone (TZ) offset (e.g. +5 hours), when doing date math.

JavaScript's built-in Date type represents a date and time not just the date. Internal representation is an integer of microseconds since 1970-01-01 00:00:00 UTC. Other languages, like Python, have separate Date and DateTime types. Java 8 introduced LocalDate.

You also have things like: new Date('5/18/2020') is local TZ (in US), but new Date('2022-05-18') is UTC. Same with Date.parse(string). And the time zone on most servers in UTC, whereas on the browser side the time zone will vary.

The date values will be used for simple date math in code and will be stored in a SQL database.

Possibilities:

  1. Use the an alternate type like integer value, of milliseconds or days (since 1970-01-01), or string in YYYYMMDD format.

  2. This was combined with #1

  3. Use Date ignoring time (as 00:00 local TZ). Convert from/to UTC when reading/writing to database

  4. Use Date with time as 00:00 UTC. Have to be careful not to mix with Date values in local TZ (e.g. now = new Date())

  5. Use Date in local TZ, but convert to UTC when read/writing to database. This is a variant of #3.

  6. Create a LocalDate class that enforces midnight.

  7. Use a library. js-joda has LocalDate.

I am leaning towards #3 and #6. Some code I am writing:

class LocalDate extends Date {
  // Error if time isn't midnight local TZ
  // Do not accept string in ISO format
  constructor(date?: Date|number|string)

  // Convert to 00:00 UTC
  // To be used before write to database
  toUtc(): Date

  // Only return date.  Also affects toJSON()
  toISOString(): string

  // Returns today's date at 00:00 Local TZ
  static today(): LocalDate
  // Set time to midnight local TZ, without error check.
  static fromDateTime(date: Date|number): LocalDate
  // Convert to local TZ.  Error if not 00:00 UTC.
  static fromUtc(date: Date|number): LocalDate
}

UPDATE:

Various edits.

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › input › date
<input type="date"> - HTML - MDN Web Docs
<input> elements of type="date" create input fields that let the user enter a date. The appearance of the date picker input UI varies based on the browser and operating system. The value is normalized to the format yyyy-mm-dd. The resulting value includes the year, month, and day, but not the time.
🌐
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
February 4, 2026 - JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate JS Reference ... Date objects are static. The "clock" is not "running". The computer clock is ticking, date objects are not. By default, JavaScript will use the browser's time zone and display a date as a full text string:
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Element › input › date
<input type="date"> - HTML: HyperText Markup Language
<input> elements of type="date" create input fields that let the user enter a date. The appearance of the date picker input UI varies based on the browser and operating system. The value is normalized to the format yyyy-mm-dd. The resulting value includes the year, month, and day, but not the time.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › time
The (Date) Time element - HTML - MDN Web Docs - Mozilla
The datetime value (the machine-readable value of the datetime) is the value of the element's datetime attribute, which must be in the proper format (see below). If the element does not have a datetime attribute, it must not have any element descendants, and the datetime value is the element's child text content.