Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript date first day of current month

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 First Day and last day of week javascript

var curr = new Date; // get current date
var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6

var firstday = new Date(curr.setDate(first)).toUTCString();
var lastday = new Date(curr.setDate(last)).toUTCString();

firstday
"Sun, 06 Mar 2011 12:25:40 GMT"
lastday
"Sat, 12 Mar 2011 12:25:40 GMT"
Comment

get first and last date of month in javascript

const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
console.log(firstDay); // Sat Oct 01 2022 ...

const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
console.log(lastDay); // Mon Oct 31 2022 ...
Comment

javascript first and last day of the month

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

js get first and last day of previous month

var d = new Date();
d.setDate(0); //sets d to the last day of the previous month
d.setDate(1); //sets d the the first day of that month
d.setHours(0,0,0,0); //sets d time to midnight

//d now equals the first day of the month before today      
Comment

PREVIOUS NEXT
Code Example
Javascript :: input type disappear side scroll react 
Javascript :: iterate over all check box in a div 
Javascript :: contries code react native 
Javascript :: tomtom map in vuejs 
Javascript :: useMatch 
Javascript :: Creating an unnamed function 
Javascript :: tinymce image and links inputs disabled 
Javascript :: await zoomus.joinmeeting crashing app react native 
Javascript :: play store version of react native app 
Javascript :: how to add class on the base of has class in jquery 
Javascript :: javascript run function forever 
Javascript :: string and charater alphabet order 
Javascript :: pebbel if statement check boolean 
Javascript :: javascript bluej 
Javascript :: cypress read xml file 
Javascript :: npm run watch-poll 
Javascript :: js stringConstructor type 
Javascript :: create react element with string 
Javascript :: knockout framework 
Javascript :: render blaze in react 
Javascript :: jQuery Validate remote method usage to check if username already exists 
Javascript :: deny ready jquery 
Javascript :: check date clash js 
Javascript :: deploy angular app on google app engine 
Javascript :: jason rpc reactjs 
Javascript :: mvc form client side validation result callback 
Javascript :: javascript masking if input matches patter 
Javascript :: when chrome loads data it resets scroll 
Javascript :: minimize and maximize div in html 
Javascript :: new activexobject( adodb.connection ) javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =