how to get only date from date object in javascript code example
Example 1: get only date from datetime javascript
var currentDate = new Date();
var date = currentDate.getDate();
var month = currentDate.getMonth(); //Be careful! January is 0 not 1
var year = currentDate.getFullYear();
var dateString = date + "-" +(month + 1) + "-" + year;
Example 2: how to get only month and year in js
let dateObj = new Date();
let myDate = (dateObj.getUTCFullYear()) + "/" + (dateObj.getMonth() + 1)+ "/" + (dateObj.getUTCDate());