Skip to content

Instantly share code, notes, and snippets.

@knightq
Created May 2, 2017 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knightq/c926bcc1a371f0f7db710ae5e674d844 to your computer and use it in GitHub Desktop.
Save knightq/c926bcc1a371f0f7db710ae5e674d844 to your computer and use it in GitHub Desktop.
Javascript - Quarter begin and quarter end
var now = new Date();
var quarter = Math.floor((now.getMonth() / 3));
var firstDate = new Date(now.getFullYear(), quarter * 3, 1);
var endDate = new Date(firstDate.getFullYear(), firstDate.getMonth() + 3, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment