Welcome to SPN

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

Sign Up Now!

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
     

Share This Page