Jump to content

This topic is 8366 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

I have a date field. I want another field to automatically be the date from this date field + 4 days. However when i do the calculation:

new field = DateField + 4, I get a new date with 4 years more. I guess the date is considered as text. I would also like to add only 4 working days to the date, for example, if my original date is a friday, and i add 4 days to it, the new date field will be Thursday, if we omit saturday and sunday.

Anybody has any idea on how to do that?

Thanks

David

Posted

If you have a date field already.

Create a calc DatePlus4 {Format as date]

Date + 4

This will give you the date plus 4 days. Just make sure the calculation is formatted as a date field.

Also this link from the Database pros website (www.databasepros.com)

http://www.filemakerpros.com/WORK.sit for mac

http://www.filemakerpros.com/WORK.zip for pc

as quoted on their site.

quote:


Work Days Tip File

Calculations that eliminate weekdays from date formulas

These calculations are very complex but are one of the only ways to eliminate weekdays from a date formula. One calculation shows how to determine the number of work days between two dates. Another demonstrates how to add a number of work days onto a beginning date. Anyone donwloading this tip should be familiar with the Position function. (25k)

HTH

  • Newbies
Posted

Try this:

Use 3 fields: DATE FIELD (formatted as date).

DATE+4 (calculation formatted as date).

DAY CALC (calculation formatted as date).

DAY CALC = Day of Week (DATE FIELD).

DATE+4= Case(DAY CALC=1,DATE FIELD+5, DAY CALC=2,DATE FIELD+4,DAY CALC=3,DATE FIELD+6,DAY CALC=4,DATE FIELD+6,DAY CALC=5,DATE FIELD+6,DAY CALC=6,DATE FIELD+6,DAY CALC=7,DATE FIELD+5,"").

DAY CALC calculates the day of the week for DATE FIELD and assigns it a number: Sun=1, Mon=2, etc..

DATE+4 now "skips" the weekend by accounting for them in the date equation. It even "skips" the weekend when your DATE FIELD date starts on a weekend day.

Good Luck!

Posted

Lets throw in another problem that may arise in this then.

What about holidays. Public holidays is it. Like 4th July, Christmas etc. (bank holidays here in the uk.) You know, where you get a monday or friday off of work with the rest of the country to go and be merry.

How are you going to trap for these (if you want to that is).

Posted

quote:

Originally posted by Andy Gaunt:

Public holidays is it. Like 4th July ... (bank holidays here in the uk.)

The 4th of July is a bank holiday in the UK?!?!?!?

Go figure.

Posted

Dan,

Where by you come to this conclusion!!!!

We don't celebrate the 4th July.

Definitely not a bank holiday here!

But, try to figure the code to calculate for these such holidays. I mean, if you want a true work day count that is.

This topic is 8366 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.