Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:49:54+00:00 2026-06-13T21:49:54+00:00

Hoping that someone could provide a function that given a date, it will return

  • 0

Hoping that someone could provide a function that given a date, it will return the NYSE trading day of month.

If it takes into consideration holidays that is a bonus, if not I’m not too worried.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:49:56+00:00Added an answer on June 13, 2026 at 9:49 pm

    There are a few packages that handle fiddly calendar issues, which are fiddly. To quote from timeDate:

    “It is non-trivial to implement function for business days, weekends and holidays. It is not difficult in an algorithmic sense, but it can become tedious to implement the rules of the calendar themselves, for example the date of Easter.”

    Still, if I have interpreted your question correctly, something like this should work (although you might want to think about the result you want if myDate is not itself a trading day…at the moment it gives the trading day of the previous trading day).

    library(RQuantLib)
    
    tradingDayOfMonth <- function(myDate, calendar = "UnitedStates/NYSE") {
      FirstOfMonth <- as.Date(paste(year(myDate), month(myDate), "01", sep="/")) 
      businessDaysBetween(calendar, from = FirstOfMonth, to = myDate,
                          includeFirst = 1, includeLast = 1)
    }
    
    tradingDayOfMonth(as.Date("2012/11/05"))
    # [1] 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was hoping someone might help with a function that given two parameters: @param
Hoping that someone could post an example of a custom function which acts similar
Hoping that someone here will be able to provide some mysql advice... I am
I was just hoping that someone could point me to a reference that defines
I was hoping that someone could tell me the best practice for the scenario
I have never really done this before so i was hoping that someone could
I was hoping someone could provide me with some basic code help in Scala.
Morning All, I was hoping someone could help or provide some sample code for
I was hoping that someone could confirm my understanding (or lack thereof!) of ADFS
Hoping that someone can help clear up this very annoying situation I find myself

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.