Answers for "read month from datetime js"

17

Javascript get month name

var  months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var d = new Date();
var monthName=months[d.getMonth()]; // "July" (or current month)
Posted by: Guest on July-31-2019
4

how to get only month and year in js

let dateObj = new Date();

let myDate = (dateObj.getUTCFullYear()) + "/" + (dateObj.getMonth() + 1)+ "/" + (dateObj.getUTCDate());
Posted by: Guest on May-14-2020
0

month javascript get data range

$(function(){
var formatted_date = function(date){
                var m = ("0"+ (date.getMonth()+1)).slice(-2); // in javascript month start from 0.
                var d = ("0"+ date.getDate()).slice(-2); // add leading zero 
                var y = date.getFullYear();
                return  m +'-'+d+'-'+y; 
}
         var curr_date =new Date();
     
         var first_day = new Date(curr_date.getFullYear(), curr_date.getMonth(), 1); 
 
         var last_day = new Date(curr_date.getFullYear(), curr_date.getMonth() + 1, 0);
                 
         var month_start_date =formatted_date(first_day);
                 
         var month_end_date =formatted_date(last_day);
                 
         date=month_start_date + ' To '+month_end_date; // date range for current month
 
        /*
         var month_end_date =formatted_date(new Date()); // limit current month date range upto current day.
       */
 
 
});
    
Posted by: Guest on May-28-2021

Code answers related to "read month from datetime js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language