JavaScript Date getHours()

The JavaScript date getHours() method is used to return the integer value between 0 and 23 that represents the hours based on the local time. Syntax: dateObj.getHours() Return: An integer value between 0 and 23. Example: <!DOCTYPE html> <html> <body> <script> var d = new Date(“March 16, 2018 13:34:45”); var n = d.getHours(); document.writeln(n) </script> … Read more