Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
java script date issue
giridhar
Hi, ihave a doubt a please clarify me.
i want to go back to four weeks back dates from todays date in my javascript code,
i can directly go back by subtracting 28 days,but every month can have 30 or 31 or 28 or 29 days.
so, I can't get correct exact date by directly subtract days from the date.
how can i go back to the particular date. And i want to know how many days are in the last month.
is there any functions to acheive this in javascript.
please give your suggestion.
Find more posts tagged with
Comments
kclark
You could use something like this to get the days in a given month<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>function DaysInMonth(y,m) {
return new Date(y,m,0).getDate();
}</pre>