Solved

getting the date of the first and last day of the current month

Posted on 2013-06-12
2
978 Views
Last Modified: 2013-07-08
Hello

I dont program in javascript so i was hoping i might be able to get some help from this forum.

I need some javascript which, when a webpage loads, gets the current date and then gets the date of the first and last day of the current month. So for example today is 12th of June and the javascript would work out that the current month is June and that the first day of the month is 2013-06-01 and the last day of the month is 2013-06-30.

This code will go in the document ready jquery function that already exists on the page.

thanks a lot
0
Comment
Question by:andieje
2 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39241083
here:
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);

Open in new window

from http://stackoverflow.com/questions/13571700/get-first-and-last-date-of-current-month-with-javascript-or-jquery
0
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39241092
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now