Javascript get a date without time | Display Example

You can javascript display date without time, by fetching only YEAR, DATE, and Month data from a date object.

How to get current date without time in JavaScript?

Here is an example of Javascript get a date without time, you have to create a date object then fetch the day, month, and year and combine it as the format you want.

See below example of display date without time or remove time from date object.


Javascript get a date without time

Another way to javascript remove time from date string

Use split method: Split it by space and take the first part like the below example code.

Output: 12/12/1020

Q: How to Javascript compare dates without time?

Answer: By using operators you can compare dates in JS, see below example code of it:-

Output: Both are equal

Read More Examples:- JavaScript Date comparison | String, time, Operators

Do comment if you have any questions and suggestions on this topic.

Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.