Re: is a date

2017-10-20 Thread Bob Sneidar via use-livecode
Because Friday, October 20, 2017 is also a date. So is 2017-10-20. So is 2017/10/20. So is 17/10/20 amd 9/20/17. Bob S > On Oct 20, 2017, at 08:43 , trevix via use-livecode > wrote: > > How about this: > > function IsDate pDate, pSysDate > > if pSysDate then > > put char 3 of the short s

Re: is a date

2017-10-20 Thread trevix via use-livecode
How about this: function IsDate pDate, pSysDate if pSysDate then put char 3 of the short system dateformat into tDelimiter else put char 3 of the short dateformat into tDelimiter end if if tDelimiter is in pDate and pDate is a date then return true return false end IsDate trevix _

Re: is a date

2017-10-16 Thread Mike Kerner via use-livecode
at 10:14 , Andrew Bell via use-livecode < >> use-livecode@lists.runrev.com> wrote: >> > >> >> From: Bob Sneidar >> >> To: How to use LiveCode >> >> Subject: Re: is a date >> >> Message-ID: <6eb529a3-5d21-4186-bd90-641746e96...@iot

Re: is a date

2017-10-16 Thread Mike Kerner via use-livecode
ng sql date. > > Bob S > > > > On Oct 16, 2017, at 10:14 , Andrew Bell via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > >> From: Bob Sneidar > >> To: How to use LiveCode > >> Subject: Re: is a date > >> Message-

Re: is a date

2017-10-16 Thread Bob Sneidar via use-livecode
t; To: How to use LiveCode >> Subject: Re: is a date >> Message-ID: <6eb529a3-5d21-4186-bd90-641746e96...@iotecdigital.com> >> Content-Type: text/plain; charset="us-ascii" >> >> This probably matters to no one at all, but SQL does not store dates with

Re: is a date

2017-10-16 Thread Andrew Bell via use-livecode
From: Bob Sneidar To: How to use LiveCode Subject: Re: is a date Message-ID: <6eb529a3-5d21-4186-bd90-641746e96...@iotecdigital.com> Content-Type: text/plain; charset="us-ascii" This probably matters to no one at all, but SQL does not store dates with forward slashes. SQL

Re: is a date

2017-10-16 Thread Roger Eller via use-livecode
Again, I would prefer a simple one-liner built-in function. What if instead of "is a date" returning true or false, it instead returned some expected outputs like "short, long, internet, seconds, ect.". Something short and sweet. ~Roger On Mon, Oct 16, 2017 at 12:56 PM, Bob Sneidar via use-live

Re: is a date

2017-10-16 Thread Bob Sneidar via use-livecode
This probably matters to no one at all, but SQL does not store dates with forward slashes. SQL datetime formats look like this: -dd-mm hh:mm:ss Bob S ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe,

Re: is a date

2017-10-16 Thread Bob Sneidar via use-livecode
This of course assumes you know tDate is supposed to be a short date. I also have this function which is part of the master library methinks: function formatDate theDate, theFormat /* Accepts any valid date for the first parameter. If not a valid date, it simply returns what was passed

Re: is a date

2017-10-16 Thread Bob Sneidar via use-livecode
Old trick I learned in Foxpro. Convert something then convert it back and see if it is identical. put 20 into tDate put tDate into tOldDate convert tDate to dateitems convert tDate to short date return ((tDate is a date) and (tDate is tOldDate)) Bob S

Re: is a date

2017-10-16 Thread Roger Eller via use-livecode
Exactly! I was elated to find the built-in "is a date" check, because I really wanted to NOT have to roll my own. I was THRILLED that our lovely English-like syntax was working FOR me. And then an integer was accepted as a legit date. I didn't like that at all. Why can't the engine have "is a

Re: is a date

2017-10-16 Thread hh via use-livecode
> JLG wrote ... > The one exception may be that any _integer_ is considered a date. > To get around that we could just check that there are 3 items > delimited by slashes before testing for "is a date". I write "is a /real/ date" into my notes whenever a meeting is a date. How do you handle such _

Re: is a date

2017-10-15 Thread Jim Lambert via use-livecode
Roger wrote: > > put "11/20/2017" is a date > returns true > > put "10" is a date > returns true > > put "raccoon" is a date > returns false > > > WHY is "10" seen as a date? Because it is legitimately a date expressed in seconds? convert 10 to long date = Wednesday, December 31,

Re: is a date

2017-10-15 Thread Mike Kerner via use-livecode
why not have the engine do it for you - use convert to convert the possible date to whatever format you're expecting. If it the answer isn't the same, then you don't have a date. On Sun, Oct 15, 2017 at 7:05 PM, J. Landman Gay via use-livecode < use-livecode@lists.runrev.com> wrote: > Yeah. Unle

Re: is a date

2017-10-15 Thread J. Landman Gay via use-livecode
Yeah. Unless you require a year or something, that'd work. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On October 15, 2017 4:23:20 PM Alex Tweedly via use-livecode wrote: Or   x is a date and x is not an

Re: is a date

2017-10-15 Thread Alex Tweedly via use-livecode
Or   x is a date and x is not an integer  ? -- Alex. On 15/10/2017 21:37, J. Landman Gay via use-livecode wrote: You know, after all the dicussion here, I'm not sure any of the options are better than "x is a date". The one exception may be that any integer is considered a date. To get around

Re: is a date

2017-10-15 Thread J. Landman Gay via use-livecode
You know, after all the dicussion here, I'm not sure any of the options are better than "x is a date". The one exception may be that any integer is considered a date. To get around that we could just check that there are 3 items delimited by slashes before testing for "is a date". -- Jacquelin

Re: is a date

2017-10-15 Thread Yves COPPE via use-livecode
Hi, Does such a text « 99/99/00 » exist ? You can also always say that it is possible that « 15/10/17 » is not a date in a certain context Now seriously if the function returns a valid date, you can test afterwards the result to see if it can be something else than a date. Now i’m not enough

Re: is a date

2017-10-15 Thread J. Landman Gay via use-livecode
On 10/15/17 1:57 PM, Mark Wieder via use-livecode wrote: On 10/15/2017 11:44 AM, J. Landman Gay via use-livecode wrote: On 10/15/17 5:10 AM, Yves COPPE via use-livecode wrote: I hope this works for any date format ... if matchtext(textToSearch,"(\d{1,2})/(\d{1,2})/(\d{2,4})",theDay,TheMonth

Re: is a date

2017-10-15 Thread Mark Wieder via use-livecode
On 10/15/2017 11:44 AM, J. Landman Gay via use-livecode wrote: On 10/15/17 5:10 AM, Yves COPPE via use-livecode wrote: I hope this works for any date format ... if matchtext(textToSearch,"(\d{1,2})/(\d{1,2})/(\d{2,4})",theDay,TheMonth,TheYear) is true then Yes, it seems to work with any n

Re: is a date

2017-10-15 Thread J. Landman Gay via use-livecode
On 10/15/17 5:10 AM, Yves COPPE via use-livecode wrote: I hope this works for any date format ... if matchtext(textToSearch,"(\d{1,2})/(\d{1,2})/(\d{2,4})",theDay,TheMonth,TheYear) is true then Yes, it seems to work with any numeric date now. I also like Ken Ray's solution which lets the

Re: is a date

2017-10-15 Thread Yves COPPE via use-livecode
Hi, I hope this works for any date format on mouseUp ask "Give a date" if it is empty then exit to top answer IsDate(it) end mouseUp function IsDate textToSearch local theDay, TheMonth, TheYear put empty into tresult if matchtext(textToSearch,"(\d{1,2})/(\d{1,2})/(\d{2,4})",theDay,TheM

Re: is a date

2017-10-14 Thread Michael Doub via use-livecode
What about this from the Master Library from Ken Ray? function isDate pWhat    /* isDate Date    Syntax:    isDate (pWhat)    Examples:    isDate("10/10/2001")    Description:    Determines if the container passed to it in contains a valid date.    Returns true or false.    Source:    Ken Ra

Re: is a date

2017-10-14 Thread J. Landman Gay via use-livecode
On 10/14/17 2:14 PM, Yves COPPE via use-livecode wrote: Try this function CheckDate pDateToCheck return matchText(pDateToCheck,"([1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9][0-9][0-9])") end CheckDate Promising, but fails with dates like "1/1/19". -- Jacqueline Landman Gay |

Re: is a date

2017-10-14 Thread Yves COPPE via use-livecode
Hi, Try this function CheckDate pDateToCheck return matchText(pDateToCheck,"([1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9][0-9][0-9])") end CheckDate answer CheckDate(tDate) > Le 14 oct. 2017 à 19:27, Roger Eller via use-livecode > a écrit : > > That's what I suspected. So to build

Re: is a date

2017-10-14 Thread Roger Eller via use-livecode
That's what I suspected. So to build a slightly better trap, I am doing this: if tDate is a date and length(tDate) > 5 and tDate contains "/" then put "true" else put "false" end if I am sure there is probably a standard way to catch all possible date formats (excluding "the seconds"),

Re: is a date

2017-10-14 Thread Klaus major-k via use-livecode
Hi Roger, > Am 14.10.2017 um 18:30 schrieb Roger Eller via use-livecode > : > > put "11/20/2017" is a date > returns true > > put "10" is a date > returns true > > put "raccoon" is a date > returns false > > > WHY is "10" seen as a date? looks like the engine is seeing seconds a