Share via

Date Field - Continuation

Anonymous
2010-06-17T19:08:30+00:00

Hi,

Ok, so i posted on here yesterday about trying to have the current date inserted at the top of my letter and then have the date of 14 days from today inserted in the body of my letter. I received help and when i did the changes to the template of my letter, it worked great. This is the field code for the date of 14 days of today:

{QUOTE

{SET Delay 14}

{SET a{=INT((14-{DATE @ M})/12}}

{SET b{={DATE @ yyyy}+4800-a}}

{SET c{={DATE @ M}+12*a-3}}

{SET d{DATE @ d}}

{SET jd{=d+INT((153*c+20/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}

{SET e{=INT((4*(jd+32044)+3)/146097)}}

{SET f{=jd+32044-INT(146097*e/4)}}

{SET g{=INT((4*f+3)/1461)}}

{SET h{=f-INT(1461*g/4)}}

{SET i{=INT((5*h+2)/153)}}

{SET dd{=h-INT((153*i+2)/5)+1}}

{SET mm{=i+3-12*INT(i/10)}}

{SET yy{=100*e+g-4800+INT(i/10)}}

Now...i have no idea what any of that means, i just know that it was working. But as soon as i added in my merge fields, things got strange. I have the current date at the top of the page (June 17, 2010), then i have some merge fields such as address, client name, date of birth, referral source and then i have the body of the letter with the second date field. As soon as i inserted the merge fields, that second date field went from displaying July 1, 2010 (what i want) to January 7, 2010. I can't figure out why or how to fix it. :S

Thanks

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2010-06-17T22:14:46+00:00

Here, if I changed the order of {dd}-{mm} I got the result that you have, so try changing it to {mm}-{dd} and see if that overcomes the issue.

-- Hope this helps.

Doug Robbins - Word MVP,

dkr[atsymbol]mvps[dot]org

Posted via the Community Bridge

"shannakinz" wrote in message news:*** Email address is removed for privacy ***...

Oops, sorry i didn't realize i had left out part of it. I actually do have it the way you said it should be:

{SET yy{=100*e+g-4800+INT(i/10)}}

“{dd}-{mm}-{yy}” @ "MMMM d, yyyy”}


Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-06-17T22:32:37+00:00

    Success! Thank you!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-06-17T21:38:53+00:00

    Oops, sorry i didn't realize i had left out part of it. I actually do have it the way you said it should be:

    {SET yy{=100*e+g-4800+INT(i/10)}}

    “{dd}-{mm}-{yy}” @ "MMMM d, yyyy”}

    Was this answer helpful?

    0 comments No comments
  3. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2010-06-17T21:15:46+00:00

    What do you have in the last two rows of the date+14 calculation field, which from the tutorial are

    {SET yy{=100*e+g-4800+INT(i/10)}}

    “{dd}-{mm}-{yy}” @ “dddd, d MMMM yyyy”}

    I think that you have changed that to:

    {SET yy{=100*e+g-4800+INT(i/10)}}

    “{mm}-{dd}-{yy}” @ “MMMM d, yyyy”}

    When it should be

    {SET yy{=100*e+g-4800+INT(i/10)}}

    “{dd}-{mm}-{yy}” @ "MMMM d, yyyy”}

    To get the field to display July 1, 2010 (or today July 2, 2010

    In other words, you must not change the "{dd}-{mm}-{yy}"

    -- Hope this helps.

    Doug Robbins - Word MVP,

    dkr[atsymbol]mvps[dot]org

    Posted via the Community Bridge

    "shannakinz" wrote in message news:*** Email address is removed for privacy ***...

    Hi,

    Ok, so i posted on here yesterday about trying to have the current date inserted at the top of my letter and then have the date of 14 days from today inserted in the body of my letter. I received help and when i did the changes to the template of my letter, it worked great. This is the field code for the date of 14 days of today:

    {QUOTE

    {SET Delay 14}

    {SET a{=INT((14-{DATE @ M})/12}}

    {SET b{={DATE @ yyyy}+4800-a}}

    {SET c{={DATE @ M}+12*a-3}}

    {SET d{DATE @ d}}

    {SET jd{=d+INT((153*c+20/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}

    {SET e{=INT((4*(jd+32044)+3)/146097)}}

    {SET f{=jd+32044-INT(146097*e/4)}}

    {SET g{=INT((4*f+3)/1461)}}

    {SET h{=f-INT(1461*g/4)}}

    {SET i{=INT((5*h+2)/153)}}

    {SET dd{=h-INT((153*i+2)/5)+1}}

    {SET mm{=i+3-12*INT(i/10)}}{SET yy{=100*e+g-4800+INT(i/10)}}

    Now...i have no idea what any of that means, i just know that it was working. But as soon as i added in my merge fields, things got strange. I have the current date at the top of the page (June 17, 2010), then i have some merge fields such as address, client name, date of birth, referral source and then i have the body of the letter with the second date field. As soon as i inserted the merge fields, that second date field went from displaying July 1, 2010 (what i want) to January 7, 2010. I can't figure out why or how to fix it. :S

    Thanks


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    Was this answer helpful?

    0 comments No comments