Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Monthly (Recurring) Target: $300 :: Achieved: $95
      Become a Supporter    ::   Make a Contribution   

Date Formula

Discussion in 'Information Technology' started by Matt W., Nov 17, 2005.

Tags:
  1. Matt W.

    Matt W.
    Expand Collapse
    Guest

    This is probably a simple question. I have a date field with a formula
    "=[hiredate] + 365*2 (I want to add exactly 2 yrs from hiredate). The problem
    is, for some of my records the formulated date is exactly 2 years from the
    hire date, which is what i want, and some dates are 1 day off. I think this
    is because of a leap year or something. I also need to calculate a hiredate +
    15 months which also gives me the same problem sometimes. If someone could
    help me i would appreciate it,
    Thanks
     
  2. Loading...


  3. Ofer

    Ofer
    Expand Collapse
    Guest

    Use the DateAdd function to do it for you

    =DateAdd("yyyy",2,[hiredate]) ' To add two Years
    =DateAdd("m",15,[hiredate]) ' To add 15 months to the date
    --
    I hope that helped
    Good Luck


    "Matt W." wrote:

    > This is probably a simple question. I have a date field with a formula
    > "=[hiredate] + 365*2 (I want to add exactly 2 yrs from hiredate). The problem
    > is, for some of my records the formulated date is exactly 2 years from the
    > hire date, which is what i want, and some dates are 1 day off. I think this
    > is because of a leap year or something. I also need to calculate a hiredate +
    > 15 months which also gives me the same problem sometimes. If someone could
    > help me i would appreciate it,
    > Thanks
     
  4. Robert_DubYa

    Robert_DubYa
    Expand Collapse
    Guest

    I think you should try using the dateadd function. Try this:
    >=DateAdd("yyyy", 1, [hiredate])-1 and <= DateAdd("yyyy", 1, [hiredate])=+1


    "Matt W." wrote:

    > This is probably a simple question. I have a date field with a formula
    > "=[hiredate] + 365*2 (I want to add exactly 2 yrs from hiredate). The problem
    > is, for some of my records the formulated date is exactly 2 years from the
    > hire date, which is what i want, and some dates are 1 day off. I think this
    > is because of a leap year or something. I also need to calculate a hiredate +
    > 15 months which also gives me the same problem sometimes. If someone could
    > help me i would appreciate it,
    > Thanks
     
  5. Matt W.

    Matt W.
    Expand Collapse
    Guest

    Thats what I needed, Thank you both

    "Robert_DubYa" wrote:

    > I think you should try using the dateadd function. Try this:
    > >=DateAdd("yyyy", 1, [hiredate])-1 and <= DateAdd("yyyy", 1, [hiredate])=+1

    >
    > "Matt W." wrote:
    >
    > > This is probably a simple question. I have a date field with a formula
    > > "=[hiredate] + 365*2 (I want to add exactly 2 yrs from hiredate). The problem
    > > is, for some of my records the formulated date is exactly 2 years from the
    > > hire date, which is what i want, and some dates are 1 day off. I think this
    > > is because of a leap year or something. I also need to calculate a hiredate +
    > > 15 months which also gives me the same problem sometimes. If someone could
    > > help me i would appreciate it,
    > > Thanks
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page