INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

how to calculate a future date

how to calculate a future date

(OP)
Good Morning

I have been trying to find a way to calculate a future date based upon an already existing date
being passed into a routine

My question is this

I have a date, for example 05/25/16 and I need to add 48 months plus 10 days to create this future date
basically for 10 business days, not a full days tens

I also have to check for holiday's after the future has been created

I can do this in Visual Foxpro, but where I am they are going to .net and this would be a great subroutine
for future processing

So if anyone can point me in the right direction on this greatly appreciated

Thanks in advance













RE: how to calculate a future date

Use the DateAdd function.

Dim CurrentDate AsDate

Dim NewDate As Date

NewDate = DateAdd(DateInterval.Month, 48, CurrentDate) 'add 48 months

Select Case NewDate.DayOfWeek
Case DayOfWeek.Saturday
NewDate = DateAdd(DateInterval.Day, 13, NewDate) 'Add 13 days: 1 to get to Sunday, 5 for the first week, 2 for the weekend, 5 more for the next week (10 business days)
Case DayOfWeek.Sunday
NewDate = DateAdd(DateInterval.Day, 12, NewDate) 'Add 12 days: 5 for the first week, 2 for the weekend, 5 more for the next week
Case Else
NewDate = DateAdd(DateInterval.Day, 14, NewDate) 'Add 14 days: 10 business days and 4 for weekends

End Select

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: how to calculate a future date

What you really need is a business-day calendar table. Every manufacturing company I've worked for has had a manufacturing-day calendar, that you can join to your table(s) and simply add to the business-days to arrive at a valid work day. No guessing for holidays or other non-work days.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: how to calculate a future date

(OP)
thank you for the info

greatly appreciated

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close