I was just looking at your code and noticed the bit at the end seemed to have something missing. 😊
SET DATE BRITISH? What's that? <g,d&rvvf> -- rk -----Original Message----- From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Dave Crozier Sent: Tuesday, May 08, 2018 9:29 AM To: profoxt...@leafe.com Subject: RE: Fun with date calculations in VFP Error Fix: The function should read as follows: *********************** * Mirrors the SQL DateAdd() function * Written By: R.D.Crozier * From an idea in MSDN Forum * Function DateAdd(tcInterval,tnIncrement,tdDateTime) Local strTime As String,strOldExact As String,strOldDate As String,vReturn As Datetime local dDateTime strOldExact = Set("Exact") strOldDate = Set("Date") strOldCentury = Set("Century") Set Date BRITISH Set Exact On dDateTime = Cast(tdDateTime As Datetime) strTime = Substr(Transform(dDateTime),10,8) strTime = Right(Transform(dDateTime),11) tcInterval = Upper(tcInterval) Do Case Case Inlist(tcInterval,"YEAR","YY","YYYY") && Years vReturn = Cast(Transform(Gomonth(dDateTime,tnIncrement*12))+" "+strTime As Datetime) Case Inlist(tcInterval,"MONTH","MM","M") && Months vReturn = Cast(Transform(Gomonth(dDateTime,tnIncrement))+" "+strTime As Datetime) Case Inlist(tcInterval,"DAY","DD","D") && Days vReturn = dDateTime + (tnIncrement * 86400) Case Inlist(tcInterval,"HOUR","HH") && Hours vReturn = dDateTime + (tnIncrement * 3600) Case Inlist(tcInterval,"MINUTE","MI","N") && Minutes vReturn = dDateTime + (tnIncrement * 60) Case Inlist(tcInterval,"SECOND","SS","S") && SECONDS vReturn = dDateTime + tnIncrement Case Inlist(tcInterval,"WEEK","WW","WK") && Weeks vReturn = dDateTime + (tnIncrement * 86400 * 7) Otherwise vReturn = dDateTime Endcase Set Date &strOldDate. Set Exact &strOldExact. set century &strOldCentury. do case case Type("tdDateTime")="D" vReturn = Cast(vReturn as Date) * case Type("tdDateTime")="T" vReturn = Cast(vReturn as DateTime) * otherwise * endcase Return vReturn * Endfunc --------------------------------------------------------------- This communication and the information it contains is intended for the person or organisation to whom it is addressed. Its contents are confidential and may be protected in law. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email. Flexipol Packaging Ltd. has taken every reasonable precaution to minimise the risk of virus transmission through email and therefore any files sent via e-mail will have been checked for known viruses. However, you are advised to run your own virus check before opening any attachments received as Flexipol Packaging Ltd will not in any event accept any liability whatsoever once an e-mail and/or any attachment is received. It is the responsibility of the recipient to ensure that they have adequate virus protection. Flexipol Packaging Ltd. Unit 14 Bentwood Road Carrs Industrial Estate Haslingden Rossendale Lancashire BB4 5HH Tel:01706-222792 Fax: 01706-224683 www.Flexipol.co.uk --------------------------------------------------------------- Terms & Conditions: Notwithstanding delivery and the passing of risk in the goods, the property in the goods shall not pass to the buyer until the seller Flexipol Packaging Ltd. ("The Company") has received in cash or cleared funds payment in full of the price of the goods and all other goods agreed to be sold by the seller to the buyer for which payment is then due. Until such time as the property in the goods passes to the buyer, the buyer shall hold the goods as the seller's fiduciary agent and bailee and keep the goods separate from those of the buyer and third parties and properly stored protected and insured and identified as the seller's property but shall be entitled to resell or use the goods in the ordinary course of its business. Until such time as the property in the goods passes to the buyer the seller shall be entitled at any time --------------------------------------------------------------- This communication and the information it contains is intended for the person or organisation to whom it is addressed. Its contents are confidential and may be protected in law. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email. Flexipol Packaging Ltd. has taken every reasonable precaution to minimise the risk of virus transmission through email and therefore any files sent via e-mail will have been checked for known viruses. However, you are advised to run your own virus check before opening any attachments received as Flexipol Packaging Ltd will not in any event accept any liability whatsoever once an e-mail and/or any attachment is received. It is the responsibility of the recipient to ensure that they have adequate virus protection. Flexipol Packaging Ltd. Unit 14 Bentwood Road Carrs Industrial Estate Haslingden Rossendale Lancashire BB4 5HH Tel:01706-222792 Fax: 01706-224683 www.Flexipol.co.uk --------------------------------------------------------------- Terms & Conditions: Notwithstanding delivery and the passing of risk in the goods, the property in the goods shall not pass to the buyer until the seller Flexipol Packaging Ltd. ("The Company") has received in cash or cleared funds payment in full of the price of the goods and all other goods agreed to be sold by the seller to the buyer for which payment is then due. Until such time as the property in the goods passes to the buyer, the buyer shall hold the goods as the seller's fiduciary agent and bailee and keep the goods separate from those of the buyer and third parties and properly stored protected and insured and identified as the seller's property but shall be entitled to resell or use the goods in the ordinary course of its business. Until such time as the property in the goods passes to the buyer the seller shall be entitled at any time _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/18725b8cd2d5d247873a2baf401d4ab2bec93...@ex2010-a-fpl.fpl.LOCAL ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious. _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/18725b8cd2d5d247873a2baf401d4ab2bec93...@ex2010-a-fpl.fpl.LOCAL ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious. Report [OT] Abuse: http://leafe.com/reportAbuse/18725b8cd2d5d247873a2baf401d4ab2bec93...@ex2010-a-fpl.fpl.LOCAL _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/dm5pr10mb124431e3200abbbde119d23dd2...@dm5pr10mb1244.namprd10.prod.outlook.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.