GithubHelp home page GithubHelp logo

dasower / nthday.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 19 KB

Javascript function to figure out the nth day of the month i.e. (last Sunday) (third Wednesday)

License: GNU General Public License v3.0

JavaScript 100.00%

nthday.js's Introduction

nthday.js

Javascript function to figure out the nth day of the month i.e. (last Sunday) (third Wednesday)

Parameters:
index: n’th occurrence of the specified day
1 - first
2 - second
3 - third
4 - fourth
5 - fifth
6 - last

day: daynumber – javascript way where sunday is 0 and is saturday is 6

month: which is 1-12 [optional – defaults to current month]

year: Full year – four digits [optional – defaults to current]


Example executions : var myDay = getNthDayOfMonth(1, 0, 9, ''); console.log("first sunday in September "+myDay);

var myDay = getNthDayOfMonth(2, 0, 9, ''); console.log("second sunday in September "+myDay);

var myDay = getNthDayOfMonth(3, 0, 10, ''); console.log("third sunday in October "+myDay);

var myDay = getNthDayOfMonth(6, 0, 11, ''); console.log("last sunday in November "+myDay);

var myDay = getNthDayOfMonth(6, 0, 12, ''); console.log("last sunday in December "+myDay);

var myDay = getNthDayOfMonth(4, 0, 1, ''); console.log("4th sunday in January?? "+myDay);

var myDay = getNthDayOfMonth(6, 0, 1, ''); console.log("last sunday in January 17 "+myDay);

var myDay = getNthDayOfMonth(6, 0, 1, '2018'); console.log("last sunday in January "+myDay);

nthday.js's People

Contributors

dasower avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.