Date Calculation Discussions (1.00)
#1
Posted 2004-12-03 21:30
#2
Posted 2004-12-04 09:50
I still have not gotten it yet as I did what you suggested but now the date is showing as May 12, 2004 even though my clock on Windows is showing the correct date for today (12/4/04).
As well their were four instances of the word date so I changed each individually and even all four but that still did not fix it.
I've attached a PDF file I created showing what I have for the field data.
Thanks again...
Curtis
Attached file(s)
-
WordField.pdf (33.51K)
Number of downloads: 39
#3
Posted 2004-12-04 21:58
The problem you're now having is because you're using a US date format, whereas the document uses non-US date formatting. This issue is discussed in the intro. To get the result you want, change:
'dd*10^6+mm'
on the last line of the field to:
'mm*10^6+dd'
Cheers
#4
Posted 2004-12-06 17:40
Hi Macropod
Thanks for the help with date calculation -
I am trying to format the output of the forward date calculated in Post 431960 in the form e.g. 31st June 2005 but with the 'st' in superscript. I can't see how I can combine the code in that section of your download with the code created to generate the date and generate the printed output.
Please can you help
Best regards
#5
Posted 2004-12-06 21:22
Change the last line from:
{=mm*10^6+dd*10^4+yy # "00'-'00'-'0000"} @ "dddd, MMMM d yyyy"}
(I'm guessing that you're using a 'dddd, MMMM d yyyy' output format) to:
{=mm*10^6+dd*10^4+yy # "00'-'00'-'0000"} @ "dddd, MMMM d
#6
Posted 2004-12-08 10:35
Thank you again - Contrary to how it may seem, I am actually doing other bits under my own steam thanks to your help.
Best regards
#7
Posted 2004-12-09 14:50
I've been testing the date calculations at extremes again before releasing the document and there seems to be a further problem with February.
If 6 months is added to Aug 29th the answer is 29-02-2005. Word formating recognises the problem and it does not display properly. The same is true for other years except leap years - when Feb 29th does exist. It is not August specific and 28th Feb is displayed correctly when the 30th and 31st of the month are entered. Also on leap year if 31st of Aug 04 has 42 months added the date reverts to 29th Feb 08 which is correct.
Have you any suggestions?
Thanks and regards
Duncan
#8
Posted 2004-12-09 22:24
Sorry 'bout that. The '>29' in the 'SET dd' expression should have been '>28'
Cheers
#9
Posted 2004-12-14 18:15
Have now done wonders in docs thanks to your date help
Am not sure if the attachment is of any use to anyone or if I reinvented a wheel.
The * Cadtext switch does not properly create a printed output for money as an example. I crated the attachment that seems to work and wondered if it might be of use to others and if perhaps you wanted to check it and let others see it?
Regards
Duncan
Attached file(s)
-
NumberstoWords.doc (23K)
Number of downloads: 20
#10
Posted 2004-12-14 19:15
First, I think you mean * Cardtext.
Second, have you tried * DollarText?
#11
Posted 2004-12-15 04:29
Your field can be both simplified and extended, as per second example in the attached in which I've implemented a solution using a FILLIN field that you could easily replace with your mergefield. This will deal with pounds to 9 digits and pennies, both as positive and negative values.
For more on Word field maths and numeric picture switches, see
Cheers
Attached file(s)
-
NumberstoWords.doc (26K)
Number of downloads: 15
#12
Posted 2005-03-22 08:23
The code in the Date Calc document (see
{SET dd{=IF(({DATE @ d}>28)*(mm=2)=1,28+((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0)),IF((mm=4)+(mm=6)+(mm=9)+(mm=11)+({DATE @ d}>30)>1,30,{DATE @ d}))}}
Cheers
#13
Posted 2005-04-24 12:25
#14
Posted 2005-04-25 21:37
(Edited by macropod on 26-Apr-05 08:37. Corrected INT syntax error in SET yy field.)
Hi gogetter,You can do this by modifying the field found under 'Calculate the day & date of the last or nth-to-last day of this month' in the DateCalc document (
. After the embedded field '{SET Subtract 0}', insert a new field coded as '{SET MAdjust -1}'
. Change the '{SET yy{DATE @ yyyy}}' field to '{SET yy{={DATE @ yyyy}+INT(({DATE @ M}+MAdjust)/12)}}'
. Change the '{SET mm{DATE @ M}}' field to {SET mm{=MOD({DATE @ M}+MAdjust-1,12)+1}}
. Change the 'dd*10^6+mm*10^4+yy' string to 'mm*10^6+dd*10^4+yy'
. Change the '"dddd, d
#15
Posted 2005-04-25 18:08
Attached file(s)
-
BillingLettersDateCalculation.doc (30.5K)
Number of downloads: 19
#16
Posted 2005-04-25 21:49
I think the reason the output hadn't changed was that you hadn't updated the field, which you do by pressing F9 - it looks like you'd simply toggled the coding view off via Shift-F9 or Alt-F9.
Had the field updated, it would have disappeared from view because of a number of editing errors. For example, you used standard braces instead of field braces (created via Ctrl-F9) in a number of places and the SET yy field has the INT expression on the wrong side of a set of field braces. You also deleted the '=' sign on the last line and replaced it with a pair of single quotes around the 'mm*10^6+dd*10^4+yy' expression. As with most programming languages, Word's field coding has an unforgiving set of syntax requirements, without which things fall over.
I've added a correctly-coded version of the field to your document so that you can compare the two (and use the latter).
Cheers
Attached file(s)
-
BillingLettersDateCalculation.doc (30.5K)
Number of downloads: 23
#17
Posted 2005-04-26 00:13
#18
Posted 2005-07-26 09:18
I want to create a field in a work document that takes the current days date and adds 19 days to it. I have read your file and just confused myself!
Hope you can help!
#19
Posted 2005-07-26 09:56
In macropod's document, look for the section labeled "Calculate a day, date, month and year, using n (301) days delay" (it's at the end of page 6 on my PC, but pagination might be slightly different on yours). This section contains a field that at the moment displays Tuesday, 17 January 2006 if you haven't updated the field, or Tuesday, 23 May 2006 (i.e. 301 days after today, 26 July 2005) if you have. Select this field, then right-click it and select Toggle Field Codes from the popup menu. You'll see
{QUOTE
{SET DELAY 301}
{SET ...
Change the 301 to 19, taking care not to change anything else. Then press F9 to hide the field codes and update the result, You should see Sunday, 14 August 2005.
You can copy the field to the clipboard and paste it into your own document.
#20
Posted 2005-07-26 10:14
I think it has worked I just have to wait until tomorrow to see if it updates automatically on opening as I am on a networked pc and I can't change the date and time!
H


This thread is closed
MultiQuote