Re: Fun with date calculations in VFP

2018-05-31 Thread Stephen Russell
In my mind was implying a DVD & Floppy Disk and not internal system drive(s). On Thu, May 31, 2018 at 8:34 AM, Ted Roche wrote: > On Tue, May 29, 2018 at 1:04 PM, Stephen Russell > wrote: > > Who has anything like a disk drive on a laptop today? > > > > Pretty sure everyone has something

Re: Fun with date calculations in VFP

2018-05-31 Thread Ted Roche
On Tue, May 29, 2018 at 1:04 PM, Stephen Russell wrote: > Who has anything like a disk drive on a laptop today? > Pretty sure everyone has something "like" a disk drive -- isn't that what the D in SSD and HDD stand for? Even my Chromebook and Android phone have something "like" a disk drive.

Re: Fun with date calculations in VFP

2018-05-30 Thread Gene Wirchenko
At 12:37 2018-05-21, Vince Teachout wrote: On 05/20/18 3:31 PM, Ted Roche wrote: On Sun, May 20, 2018 at 1:39 PM, Gene Wirchenko wrote: thedate=date(,12,31) && Handle this extreme case. And that, kids, is why we call it "The Y10K crisis..." I looking forward to all the

Re: Fun with date calculations in VFP

2018-05-30 Thread Vince Teachout
On 05/29/18 1:04 PM, Stephen Russell wrote: Who has anything like a disk drive on a laptop today? Good point. You think that problem might get worse by 9,999 A.D.? --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Re: Fun with date calculations in VFP

2018-05-29 Thread Stephen Russell
Who has anything like a disk drive on a laptop today? On Mon, May 21, 2018 at 2:37 PM, Vince Teachout wrote: > On 05/20/18 3:31 PM, Ted Roche wrote: > >> On Sun, May 20, 2018 at 1:39 PM, Gene Wirchenko wrote: >> >> thedate=date(,12,31) && Handle this extreme case. >>> >> >> And

Re: Fun with date calculations in VFP

2018-05-29 Thread mbsoftwaresolutions
On 2018-05-21 15:37, Vince Teachout wrote: On 05/20/18 3:31 PM, Ted Roche wrote: On Sun, May 20, 2018 at 1:39 PM, Gene Wirchenko wrote: thedate=date(,12,31) && Handle this extreme case. And that, kids, is why we call it "The Y10K crisis..." I looking forward to all the

Re: Fun with date calculations in VFP

2018-05-29 Thread Vince Teachout
On 05/20/18 3:31 PM, Ted Roche wrote: On Sun, May 20, 2018 at 1:39 PM, Gene Wirchenko wrote: thedate=date(,12,31) && Handle this extreme case. And that, kids, is why we call it "The Y10K crisis..." I looking forward to all the I'm going to make when people call me in

RE: Fun with date calculations in VFP

2018-05-23 Thread Paul H. Tarver
Lol Paul H. Tarver -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Gene Wirchenko Sent: Tuesday, May 22, 2018 8:41 PM To: profoxt...@leafe.com Subject: RE: Fun with date calculations in VFP At 08:38 2018-05-22, "Paul H. Tarver" <p.

RE: Fun with date calculations in VFP

2018-05-22 Thread Gene Wirchenko
At 08:38 2018-05-22, "Paul H. Tarver" <p...@tpcqpc.com> wrote: -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Gene Wirchenko Sent: Monday, May 21, 2018 9:03 PM To: profoxt...@leafe.com Subject: Re: Fun with date calculations in VF

RE: Fun with date calculations in VFP

2018-05-22 Thread Paul H. Tarver
I'm starting to feel the panic rise...No clients calling yet, but it's coming... Paul H. Tarver -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Gene Wirchenko Sent: Monday, May 21, 2018 9:03 PM To: profoxt...@leafe.com Subject: Re: Fun with date

Re: Fun with date calculations in VFP

2018-05-21 Thread Gene Wirchenko
At 12:31 2018-05-20, Ted Roche wrote: On Sun, May 20, 2018 at 1:39 PM, Gene Wirchenko wrote: > thedate=date(,12,31) && Handle this extreme case. And that, kids, is why we call it "The Y10K crisis..." It is not a crisis yet. You have

Re: Fun with date calculations in VFP

2018-05-21 Thread Ted Roche
On Mon, May 21, 2018 at 3:37 PM, Vince Teachout wrote: > > nb: Don't lose vfp install disk before then! > Gotcha covered: https://imgur.com/a/NPMsnUL Hmm... might need to find a disk drive too. And a controller. Edge-connector cable... hmm -- Ted Roche Ted Roche &

RE: Fun with date calculations in VFP

2018-05-21 Thread Paul Newton
k) - loDaysOfWeek.Item(CDOW(ldLastDate,7) EndIf Return ldLastDate -Original Message- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Ted Roche Sent: 20 May 2018 20:32 To: profox@leafe.com Subject: Re: Fun with date calculations in VFP On Sun, May 20, 2018 at 1:39 PM, Gene Wirch

Re: Fun with date calculations in VFP

2018-05-20 Thread Ted Roche
On Sun, May 20, 2018 at 1:39 PM, Gene Wirchenko wrote: > thedate=date(,12,31) && Handle this extreme case. And that, kids, is why we call it "The Y10K crisis..." -- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com

Re: Fun with date calculations in VFP

2018-05-20 Thread Gene Wirchenko
At 08:30 2018-05-18, mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: On 2018-05-16 18:02, Ted Roche wrote: LastDayOfMonth() or LDOM back in my 8.3 days, was always a popular request: http://fox.wikis.com/wc.dll?Wiki~FindingTheLastDayOfTheMonth~VB Ed Leafe had shared a ton of date

Re: Fun with date calculations in VFP

2018-05-18 Thread Eric Selje
Pro: It's magic ! > (¸.·``··* > > > > > -Ursprüngliche Nachricht- > Von: ProFox <profox-boun...@leafe.com> Im Auftrag von Frank Cazabon > Gesendet: Freitag, 18. Mai 2018 18:41 > An: profox@leafe.com > Betreff: Re: Fun with date calculations in VFP > >

Re: Fun with date calculations in VFP

2018-05-18 Thread Frank Cazabon
Lots of spare time today so some hopefully constructive criticism: :) I would redo some of that code to get away from CTOD() as that will fail depending on SET STRICTDATE and if SET DATE is anything besides MDY. I have a feeling that your first day of week and last day of week will be

Re: Fun with date calculations in VFP

2018-05-18 Thread mbsoftwaresolutions
On 2018-05-16 18:02, Ted Roche wrote: LastDayOfMonth() or LDOM back in my 8.3 days, was always a popular request: http://fox.wikis.com/wc.dll?Wiki~FindingTheLastDayOfTheMonth~VB Ed Leafe had shared a ton of date functions for VFP years ago. Here's what I have in my framework from Ed:

RE: Fun with date calculations in VFP

2018-05-18 Thread Paul Newton
:29 To: ProFox Email List <profox@leafe.com> Subject: Re: Fun with date calculations in VFP Updated. Clearly a lot of stuff left to do on this class! I got distracted by "work" but feel free to clone and contribute. set proc to datetime addi _vfp.addoboject("DateTime"

Re: Fun with date calculations in VFP

2018-05-17 Thread Ted Roche
On Thu, May 17, 2018 at 8:11 AM, Alan Bourke wrote: > There's a VFP implementation of the C# String.Format() here: > http://saltydogllc.com/string-format-for-visual-foxpro/ Cool! Check that off the list! -- Ted Roche Ted Roche & Associates, LLC

Re: Fun with date calculations in VFP

2018-05-17 Thread Alan Bourke
There's a VFP implementation of the C# String.Format() here: http://saltydogllc.com/string-format-for-visual-foxpro/ -- Alan Bourke alanpbourke (at) fastmail (dot) fm ___ Post Messages to: ProFox@leafe.com Subscription Maintenance:

Re: Fun with date calculations in VFP

2018-05-17 Thread Ted Roche
You have a set of Add functions: AddYears, AddDays, AddHours, Minutes, Seconds, Ticks... where's AddMonth, besides the obvious GOMONTH()? Time support native in VFP has always been weak. I wrote a s2hms and hms2s to convert between seconds and HH:MM:SS strings. DTOT converts a Data to a datetime

Re: Fun with date calculations in VFP

2018-05-16 Thread Eric Selje
Updated. Clearly a lot of stuff left to do on this class! I got distracted by "work" but feel free to clone and contribute. set proc to datetime addi _vfp.addoboject("DateTime", "DateTime") && Now it's always available ? _vfp.DateTime.FirstDayOfMonth()&& 05/01/2018 ?

Re: Fun with date calculations in VFP

2018-05-16 Thread Ted Roche
LastDayOfMonth() or LDOM back in my 8.3 days, was always a popular request: http://fox.wikis.com/wc.dll?Wiki~FindingTheLastDayOfTheMonth~VB -- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com ___ Post Messages to: ProFox@leafe.com

Re: Fun with date calculations in VFP

2018-05-16 Thread Eric Selje
gt; > > -Ursprüngliche Nachricht- > Von: ProFox <profox-boun...@leafe.com> Im Auftrag von Eric Selje > Gesendet: Dienstag, 15. Mai 2018 22:20 > An: ProFox Email List <profox@leafe.com> > Betreff: Re: Fun with date calculations in VFP > > I've started a class for a

Re: Fun with date calculations in VFP

2018-05-15 Thread Eric Selje
I've started a class for a C# like DateTime static class here: https://github.com/eselje/FoxTypes/blob/master/FT_DATETIME.md I may steal some of the ideas here to embellish it, but if you have time and want to contribute please clone this repo and submit a pull request when done. It's pretty

Re: Fun with date calculations in VFP

2018-05-09 Thread Ted Roche
On Tue, May 8, 2018 at 5:39 PM, Richard Kaye wrote: > I owe you a Scotch next time you're in the area. > Deal! -- Ted Roche & Associates, LLC http://www.tedroche.com ___ Post Messages to: ProFox@leafe.com Subscription

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
I owe you a Scotch next time you're in the area. -- rk -Original Message- From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Ted Roche Sent: Tuesday, May 08, 2018 5:15 PM To: profoxt...@leafe.com Subject: Re: Fun with date calculations in VFP Did I mention I like dat

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
an ICASE? (I haven't quite wrapped my head around what you're doing >>> there but it seems like there are 3 states?) >>> >>> m.theOffset=ICASE(theDiff>3, 7-m.theDiff,theDiff<-3, 7+m.theDiff, m.theDiff) >>> >>> -- >>> >>> rk

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
9)+CDOW(olddate(DATE()+1,-2)) >>> ? [Same day 3 years ago: ] >>> ?? olddate(DATE()+1,-3) >>> ?? CHR(9)+CDOW(olddate(DATE()+1,-3)) >>> ? [Same day 10 years ago: ] >>> ?? olddate(DATE()+1,-10) >>> ?? [ ]+CDOW(olddate(DATE()+1,-10)) >>> >>&

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
.theDiff, m.theDiff) > > -- > > rk > > -Original Message- > From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Ted Roche > Sent: Tuesday, May 08, 2018 3:25 PM > To: profoxt...@leafe.com > Subject: Re: Fun with date calculations in VFP > >

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
ehalf Of Ted Roche Sent: Tuesday, May 08, 2018 3:25 PM To: profoxt...@leafe.com Subject: Re: Fun with date calculations in VFP GOMONTH() just moves back to 2/28 on years that don't have a 2/29, so your olddate({^2016-02-29},-2) gives you the previous Tuesday, 2/24/2014. Hmmm. That's an OBO. It

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
f the week > LOCAL m.theDiff, m.theOffset > m.theDiff=DOW(m.theDate)-DOW(GOMONTH(m.theDate, m.offset*12)) > m.theOffset=IIF(theDiff>3, 7-m.theDiff, m.theDiff) > RETURN GOMONTH(m.theDate, m.offset*12) + m.theOffset > > ENDFUNC > > -- > > rk > > -Original Message---

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
ech <profoxtech-boun...@leafe.com> On Behalf Of Gene Wirchenko Sent: Tuesday, May 08, 2018 12:46 PM To: profoxt...@leafe.com Subject: RE: Fun with date calculations in VFP At 06:27 2018-05-08, Richard Kaye <rk...@invaluable.com> wrote: >The latter. And that was the approach I was ju

Re: Fun with date calculations in VFP

2018-05-08 Thread Jean Laeremans
Rofl Op di 8 mei 2018 16:27 schreef Ted Roche : > On Tue, May 8, 2018 at 11:23 AM, Richard Kaye > wrote: > > Another guy that fixes his typos the 2nd time...  Thanks, Ted! > > :) > > Well, the first version ran great in GMail! The second version I >

RE: Fun with date calculations in VFP

2018-05-08 Thread Gene Wirchenko
At 06:27 2018-05-08, Richard Kaye wrote: The latter. And that was the approach I was just working through. What about the week every few years that you will be disregarding? A year has 52 weeks plus one or two days. [snip] Sincerely, Gene Wirchenko

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
:00 PM To: profoxt...@leafe.com Subject: RE: Fun with date calculations in VFP Richard, It was the Google Effect ... just like mine!! Dave Crozier Software Development Manager Flexipol Packaging Ltd. -Original Message- From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Ted Roche S

RE: Fun with date calculations in VFP

2018-05-08 Thread Dave Crozier
t: 08 May 2018 16:53 To: profox@leafe.com Subject: RE: Fun with date calculations in VFP lol -- rk -Original Message- From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Ted Roche Sent: Tuesday, May 08, 2018 11:28 AM To: profoxt...@leafe.com Subject: Re: Fun with date calculat

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
lol -- rk -Original Message- From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Ted Roche Sent: Tuesday, May 08, 2018 11:28 AM To: profoxt...@leafe.com Subject: Re: Fun with date calculations in VFP On Tue, May 8, 2018 at 11:23 AM, Richard Kaye <rk...@invaluable.c

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
On Tue, May 8, 2018 at 11:23 AM, Richard Kaye wrote: > Another guy that fixes his typos the 2nd time...  Thanks, Ted! :) Well, the first version ran great in GMail! The second version I actually tried running in VFP ;) ___ Post

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
Another guy that fixes his typos the 2nd time...  Thanks, Ted! -- rk -Original Message- From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Ted Roche Sent: Tuesday, May 08, 2018 11:12 AM To: profoxt...@leafe.com Subject: Re: Fun with date calculations in VFP Or, clea

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
Or, cleaned up a bit: FUNCTION olddate(thedate, offset) * parameters: thedate: date to start from * offset: number of years offset, positive or negative * returns: nearest date to the offset that falls on the same day of the week LOCAL thediff, theoffset thediff =

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
On Tue, May 8, 2018 at 9:14 AM, Ted Roche wrote: > So, do you want a function that returns the second Tuesday in May or > one that returns the Tuesday closest to May 8? Both would fit the > specs. > > Date math was one of my many VFP hobbies. There were lots of date math >

Re: Fun with date calculations in VFP

2018-05-08 Thread Stephen Russell
I found a millisecond approach a while back that hasn't given us any issues yet 60480 milliseconds in a week is the fact I base the code on. var date:Date = new Date(, MM, DD); Datetime lastyear = date.setMilliseconds(date.milliseconds - 60480 * 52); On Tue, May 8, 2018 at 8:07

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
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) L

RE: Fun with date calculations in VFP

2018-05-08 Thread Dave Crozier
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

RE: Fun with date calculations in VFP

2018-05-08 Thread Richard Kaye
e: Fun with date calculations in VFP So, do you want a function that returns the second Tuesday in May or one that returns the Tuesday closest to May 8? Both would fit the specs. Date math was one of my many VFP hobbies. There were lots of date math answers in Ask Advisor. GOMONTH() gets you to th

Re: Fun with date calculations in VFP

2018-05-08 Thread Ted Roche
So, do you want a function that returns the second Tuesday in May or one that returns the Tuesday closest to May 8? Both would fit the specs. Date math was one of my many VFP hobbies. There were lots of date math answers in Ask Advisor. GOMONTH() gets you to the year you want, then you can use

RE: Fun with date calculations in VFP

2018-05-08 Thread Dave Crozier
clear set century on dDate=Date() ? DateAdd("YY", 5, dDate) ? DateAdd("WEEK", 5, dDate) * return * Mirrors TSQL DateAdd() Function * Example: * ? DateAdd("YY", 2, Date()) * Function DateAdd(tcInterval,tnIncrement,tdDateTime) Local strTime As String,strOldExact As String,strOldDate As