View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Date Calculation Question for Macropod

Hi Graham,

"No doubt Macropod will be along soon with his observations". Hmm, 'soon' has interesting connotations in this context - my initial
reply preceded yours!

--
Cheers
macropod
[MVP - Microsoft Word]


"Graham Mayor" wrote in message ...
Macropod has covered TIME delays at the end of document you can download from http://www.gmayor.com/downloads.htm#Third_party
To add 12 hours to the Time associated with the SAVEDATE, substitute SAVEDATE for the TIME field and change the delay to 12:00:00
thus:

{QUOTE
{SET Time1 {SAVEDATE \@ HH:mm:ss}}
{SET Time2 12:00:00}
{SET SumTime{=({Time1 \@ HH}+{Time2 \@ HH})*3600+({Time1 \@ mm}+{Time2 \@ mm})*60+{Time1 \@ ss}+{Time2 \@ ss}}}
{=INT(SumTime/86400) \# +0\ ;-0\ ;}
{=(MOD(ABS(INT(SumTime/3600)+11),12)+1)*10000+INT((SumTime-INT(SumTime/3600)*3600)/60)*100+MOD(SumTime,60) \# 0:00:00}
{IF{=MOD(INT(SumTime/3600),24)} 12 \ a.m. \ p.m.}}

or (24 hour clock).


{QUOTE
{SET Time1 {SAVEDATE \@ HH:mm:ss}}
{SET Time2 12:00:00}
{SET SumTime{=({Time1 \@ HH}+{Time2 \@ HH})*3600+({Time1 \@ mm}+{Time2 \@ mm})*60+{Time1 \@ ss}+{Time2 \@ ss}}}
{=INT(SumTime/86400) \# +0\ ;-0\ ;}
{=(MOD(ABS(INT(SumTime/3600)+23),24)+1)*10000+INT((SumTime-INT(SumTime/3600)*3600)/60)*100+MOD(SumTime,60) \# 00:00:00}}

Note that savedate fields do not update automatically when you save the document. This can result in the form showing incorrect
dates and then if the fields are updated the form will require saving again to record the new savedate, and thus the savedate
saved with the document is the previous savedate and not the current one. Are you sure that Savedate is the best date type for
your requirements? Frankly if you save the form as a template and create form documents from it Createdate would probably make
more sense.

No doubt Macropod will be along soon with his observations

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Jenny B. wrote:
Hi Macropod,

I've read through your past postings on how to calculate between
dates for different periods of time (great work by the way).
However, most of the examples don't seem to focus on doing
calculations for just Time Difference vs. calculating Date Periods.
I'm trying to add time to the SAVEDATE time value. I still need the
SAVEDATE value to appear on my form, but I'm hoping to add another
field using that same logic as a springboard. I'd like to add 12
hours to the SAVEDATE time after the user saves the doc, but show
just the hour, minute, seconds and am/pm after calculation.

Do you have any other postings or documentation that provides
examples doing this vs. calculating the date periods?

Thank you for your review and thoughts - Jenny B.


EXAMPLE -- {=SAVEDATE \@ "M/d/yyy h:mmm:ss am/pm"} + 12 hours - -
GOAL - to have result appear as just H:MMM:SS AM/PM 12 hours later