Home > Work > Current Year, Month and Quarter in JavaScript #SP2010 #SharePoint #PS2010 #MSProject #ProjectServer #in

Current Year, Month and Quarter in JavaScript #SP2010 #SharePoint #PS2010 #MSProject #ProjectServer #in

Just a quick post to show some useful JavaScript I have been using this week.

In particular a one liner to work out the current quarter.

1 var currentYear = (new Date).getFullYear(); 2 var currentMonth = (new Date).getMonth(); 3 var currentQuarter = Math.floor(((currentMonth + 11) / 3) % 4) + 1;

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: