javascript get current time

Get Current Date & Time, print Current Date, Current Time and Current Date & Time Both using JavaScript Example.

Date and time js Tutorial

here I will learn How to Get Current Date & Time in JavaScript?

var today = new Date();   

: Related Query :

Read Also:  Laravel 6 group by month/year using Eloquent

Current Date in JavaScripts

var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();

Current Time in JavaScripts

var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();

Also Read: How to Get Current Date & Time in JavaScripts?

Current Date & Time Both in JavaScript

var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;