Results 1 to 13 of 13

Thread: VB.net - How to check if one business day has passed

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    VB.net - How to check if one business day has passed

    Hi ,
    In a specific case I need to know if a business day has passed from a specific date. By business day I mean a day excluding the weekends.
    How can I do that using VB.net?

    Thanks in advance.

  2. #2
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: VB.net - How to check if one business day has passed

    Ok so what did you search for first?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by Grand View Post
    How can I do that using VB.net?
    This is a big problem for many people. They start with a problem and immediately jump to trying to write code and they fail because they have no real idea what the code is supposed to do. That's not how software development works. The first step is not asking how you would write the code but rather how would you solve the problem if you were NOT writing code. Programming doesn't exist in a vacuum. This problem is not something unique to programming. If you had to do it manually, how would you do it? Work that out first and then write down. Anyone can do that because it has nothing to do with programming. What you write down should be specific enough to hand to someone with no experience with the problem such that they can get the right output for any input. At that stage, you have an algorithm. Only then should you consider writing code and the code you write should be a specific implementation of that algorithm. At every stage, you can compare your code to the algorithm to see if they match. If the algorithm works and the code doesn't then the code doesn't implement the algorithm, so you always have some to check to find where the error is in your code. If you haven't done all this then you haven't really tried to solve the problem. Reading the problem, deciding you don't know how to write the code and asking someone else to do it for you isn't programming.

  4. #4
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,045

    Re: VB.net - How to check if one business day has passed

    checkout and read about -DayofWeek-

    Code:
    ..DayOfWeek.Saturday OrElse ....
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by jmcilhinney View Post
    This is a big problem for many people. They start with a problem and immediately jump to trying to write code and they fail because they have no real idea what the code is supposed to do. That's not how software development works. The first step is not asking how you would write the code but rather how would you solve the problem if you were NOT writing code. Programming doesn't exist in a vacuum. This problem is not something unique to programming. If you had to do it manually, how would you do it? Work that out first and then write down. Anyone can do that because it has nothing to do with programming. What you write down should be specific enough to hand to someone with no experience with the problem such that they can get the right output for any input. At that stage, you have an algorithm. Only then should you consider writing code and the code you write should be a specific implementation of that algorithm. At every stage, you can compare your code to the algorithm to see if they match. If the algorithm works and the code doesn't then the code doesn't implement the algorithm, so you always have some to check to find where the error is in your code. If you haven't done all this then you haven't really tried to solve the problem. Reading the problem, deciding you don't know how to write the code and asking someone else to do it for you isn't programming.
    I get your point. Please don't assume that I don't want to spend any effort. I, however, hoped that if someone already had done a similar thing, then that person would share it with me instead of me re-inventing it.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by Grand View Post
    Please don't assume that I don't want to spend any effort. I, however, hoped that if someone already had done a similar thing, then that person would share it with me instead of me re-inventing it.
    That's kind of a contradiction, isn't it? Couldn't you say that about every bit of code you ever write?

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Re: VB.net - How to check if one business day has passed

    Yes, yes I can. And I am unable to see what could be wrong with it.
    I am not too keen on "reinventing the wheel" and most of the time "steal with pride" to accelerate the to progress. Of course as you brought it up, it won't help if the goal was me becoming a SW developer, but that is not really my current goal.
    But I agree with your logic of how to develop a SW or generally approach a problem; what I differ with your view is that I generally see if a solution is already available before I make one. Still learning how to that too.

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by Grand View Post
    I generally see if a solution is already available before I make one.
    There's a difference between looking for an existing solution, which involves some effort on your own behalf, and asking others to provide you with a solution, which involves none of your own effort. Everyone takes bits and pieces from various places when they need it. Most people don't ask others to write their code for them as a first option. That's just lazy. You may be OK with laziness - that's your prerogative - but laziness it is. I tend to point out laziness when I see it, in an effort to discourage others from encouraging it.

  9. #9
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by Grand View Post
    Hi ,
    In a specific case I need to know if a business day has passed from a specific date. By business day I mean a day excluding the weekends.
    How can I do that using VB.net?

    Thanks in advance.
    You might want to include holidays in your solution. I think most people accomplish that with holiday calendars for a lookup.
    Please remember next time...elections matter!

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Re: VB.net - How to check if one business day has passed

    Facebook initiated:
    "There's a difference between looking for an existing solution, which involves some effort on your own behalf, and asking others to provide you with a solution, which involves none of your own effort."

    You are stating the obvious and turn it as if what you quoted above meant that I won’t know the difference and also spend no effort looking for an existing solution. I am not sure what most people do, but it seems that you do. However, me looking for an existing solution before me making one, was wrongly interpreted by you as me asking people to write my code for me. It sounds as if you assume the worst in people and interpret out of context.
    If I read correctly, you believe, you pointed out my laziness because of what I said above or maybe some other cases. The smart (not lazy way) way is actually to reuse an already existing solution if there is one. Me looking for it as the first thing because I don't have it does not make me lazy. If I ask someone to help me with the code it is not because I am lazy to write it myself, it more because I lack basic and don't know much in this field. I guess laziness could be one of the reasons and somehow you label people for the worst possible reason that there could be. Why you assume the worst, I am not sure about. Maybe the reason could be, taking things out of context or making your own context by adding to the pile of our transgression-log each time we do wrong, ask questions that does not make sense to you or write something that it might be stupid, lazy, etc to you.
    So, in this post, the effort I spent was to figure out that I am unable to figure it out and here I am looking for someone who would like to share his/her solution with me. And it is not up to you to label those people who would like to share and discourage those who would want to do that because you made your mind about the requester and “pointed out their laziness”. I myself, usually work before and parallel with my inquiry too but in some cases I am totally dependent on the help I get.
    If you find something within 30 second which I was not able to find within an hour or more, you would think this person is so lazy that won't spend 30 second to search for it. However, there might be something here that you might assumed or overlooked about that person. Please tell what kind of proof this forum needs to be presented in every inquiry that shows that the thread starter has not been lazy, stupid etc.
    I would say where there is a difference between opinions, it won't make your or my opinion right. And one can be wrong; maybe for the first time in life. To make an informed opinion, one would require some facts which is not available to you, at least in my case. In addition, there are ways to communicate our dissatisfaction or express our feelings about things, here you chose the rude way to do that. It is not uncommon that one would do that when they feel superior because of their knowledge in this field. Talking from experience now.
    Please do me a favour and stop calling my actions either stupid or lazy. Instead, please either don’t help or if your help requires me to proof to you that I was not lazy, then let me know how I can do that.
    Thank you.
    Facebook terminated.
    Last edited by Grand; Oct 28th, 2019 at 02:22 PM.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by TysonLPrice View Post
    You might want to include holidays in your solution. I think most people accomplish that with holiday calendars for a lookup.
    Those holidays, are they something that need to written and maintained manually or can be imported from e.g. Outlook?

  12. #12
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,388

    Re: VB.net - How to check if one business day has passed

    Quote Originally Posted by Grand View Post
    Those holidays, are they something that need to written and maintained manually or can be imported from e.g. Outlook?
    This is up to you to determine ... if you took jmcilhinney's advice, "the first step is not asking how you would write the code but rather how would you solve the problem if you were NOT writing code", we would know what you wanted as this would be defined in this step...

    At work we have holidays hard coded on dates that need to be re-entered each new year (not my favorite way of doing it) as the whole date (including the year) is stored.
    At my old company we have dates based on combinations of complex logic :P ... for eg Easter day calculation, + repetitive dates such as Christmas day, or one off dates - all defined in a single table.

    I would suggest NOT using the Google holiday calendar, pain to maintain API, and here in Australia it also lists the same holiday multiple times for different regions ... e.g. the Queens Birthday occurs 3x ... one for each region :P ... but each place only gets this 1x ... it just falls on different days.

    Kris

  13. #13
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,045

    Re: VB.net - How to check if one business day has passed

    @ Grand

    why don't you show what you have tried, and we'll take it from there
    or else the Thread was pointless
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width