Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get current month start and end date

var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
Comment

get current month number javascript

// Make an instance or object of the Date constructor
const currentDate = new Date();
// get the current month number
const monthNumber = currentDate.getMonth();
console.log(monthNumber); // eg: 8
Comment

get full month from date javascript

//Get full month from date javascript
const date = new Date(2009, 10, 10);  // 2009-11-10
const month = date.toLocaleString('default', { month: 'long' });
console.log("Result - ", month); // Result - November
Comment

month start date and end date in js

const moment = require('moment');

let year = '2022';
let month = '2';
let startDate = moment([year, month - 1]);
let endDate = moment(startDate).endOf('month');

console.log(startDate, endDate);
Comment

PREVIOUS NEXT
Code Example
Javascript :: pick a random element from an array javascript 
Javascript :: javascript screen size 
Javascript :: function to generate random color in javascript 
Javascript :: javascript get element width and height 
Javascript :: react native image fit container 
Javascript :: jquery disable class attribute 
Javascript :: sorting array without sort method in javascript 
Javascript :: js fake await 
Javascript :: href back page javascript 
Javascript :: set port in react app 
Javascript :: jquery cdn cloudflare 
Javascript :: navigate to url jquery 
Javascript :: javascript select element with attribute 
Javascript :: javascript remove all whitespaces 
Javascript :: regex special characters javascript 
Javascript :: uppercase string in js 
Javascript :: Sweetalert button color 
Javascript :: update to specific version of node brew 
Javascript :: javascript date minus seconds 
Javascript :: javascript sort by numerical value 
Javascript :: jquery checkbox checked value 
Javascript :: how to remove a class in js after 100 milliseconds 
Javascript :: nodejs does every worker thread need a new core 
Javascript :: react native android build 
Javascript :: html string to html 
Javascript :: ngfor on keys of a dictionary angular 
Javascript :: react native italic text 
Javascript :: javascript is number an integer 
Javascript :: vue npx 
Javascript :: datatable remove show 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =