Re: Convert date

2023-07-15 Thread Mark Smith via use-livecode
Thanks Bob. These examples are all very handy to have. Added to the wiki!! Just kidding, I do think we need a wiki somewhere for these kinds of code snippets but I’m not offering to build it (this year). We’ll have to see how bored I am next year, or, hopefully, someone else will beat me to it.

Re: Convert date

2023-07-15 Thread Alex Tweedly via use-livecode
On 14/07/2023 19:45, Bob Sneidar via use-livecode wrote: Because I’m not that good with regular expressions and the format function. :-) But you example has one too many close parens. Oops - I got caught out copying / pasting again :-( Yes, of course it should have been put format("%s-%02d

Re: Convert date

2023-07-15 Thread Alex Tweedly via use-livecode
On 14/07/2023 16:13, Bob Sneidar via use-livecode wrote: I beg to differ. Again, Livecode is a way to build both the tools and the product made by those tools. Livecode is NOT a collection of every conceivable tool for everything everyone wants to do. No language is. I think the LC dev team

Re: Convert date

2023-07-14 Thread Bob Sneidar via use-livecode
Because I’m not that good with regular expressions and the format function. :-) But you example has one too many close parens. Also, for SQL Date I do not thing UK or US matters. It’s -MM-DD everywhere, isn’t it? Also, I assumed that the localization of the LC engine would take into accou

Re: Convert date

2023-07-14 Thread Alex Tweedly via use-livecode
On 14/07/2023 16:34, Bob Sneidar via use-livecode wrote: CASE "sql date" put item 1 of theDate & "-" & \ format("%02d",item 2 of theDate) & "-" & \ format("%02d",item 3 of theDate) into theDate break Why not just put format("%s-%02d-%02d",

Re: Convert date

2023-07-14 Thread Bob Sneidar via use-livecode
Hmmm… I read the enhancement request. I’m still in the dark though on how to get to "2023-07-14 08:30:00" from “7/14/23” using format strings. Here’s my solution for those who do not want to download the masterLibrary. Given these, what else do you need? FUNCTION formatDate theDate, theFormat

Re: Convert date

2023-07-14 Thread Brian Milby via use-livecode
We actually do with LCB libraries (Icon SVG Library is one example), but with the caveat that they are not as performant as LCS code in many cases (compare the LCS and LCB implementations of JSON for example). LCS libraries are doable too. Just make everything internal private/script local and

Re: Convert date

2023-07-14 Thread Bob Sneidar via use-livecode
I beg to differ. Again, Livecode is a way to build both the tools and the product made by those tools. Livecode is NOT a collection of every conceivable tool for everything everyone wants to do. No language is. I think the LC dev team is far more useful to everyone if they focus on completing

Re: Convert date

2023-07-14 Thread Mark Smith via use-livecode
Which makes me think, it would be nice if we could have plug-in code modules. Essentially a faceless widget that could be called to perform some sort of action (with parameters). Completely encapsulated. Or is that “bat crazy” as Mike would say 😊 > On 14 Jul 2023, at 12:08 pm, Paul Dupuis via u

Re: Convert date

2023-07-14 Thread Paul Dupuis via use-livecode
Yes to this. I have, lot so many developer, a set of functions to translate to and from this date format. We can all write our own or use ones others have provided, but it would be nice if this was built into the language. On 7/13/2023 10:59 PM, Neville Smythe via use-livecode wrote: Jacque

Re: Convert date

2023-07-13 Thread Neville Smythe via use-livecode
Jacque: Nice! Particularly as a demonstration of the variety of ways to achieve an objective in LC and different coding styles. I’ll add the snippets to my own version. The ISO date (aka sql date) format is my favourite because it avoids the ambiguity of the English/American ordering of day, mo

Re: Convert date

2023-07-13 Thread ambassador--- via use-livecode
Neville Smythe wrote: > I seem to have hallucinated that the built-in convert handler recognised > the ISO date and dateTime formats (-MM-DD, -MM-DD  > hh:mm:ss+-http://hh.ss, etc) but I must have written my own conversion > routines in a former life. > But one would have to ask… Why doesn’

Re: Convert date

2023-07-13 Thread J. Landman Gay via use-livecode
On 7/13/23 3:19 AM, Neville Smythe via use-livecode wrote: I seem to have hallucinated that the built-in convert handler recognised the ISO date and dateTime formats (-MM-DD, -MM-DD hh:mm:ss+-hh.ss, etc) but I must have written my own conversion routines in a former life. But one would

Re: Convert date

2023-07-13 Thread Mark Smith via use-livecode
Thanks Bob. Sounds very useful. How does one access (or locate) the master library? Cheers, Mark Sent from my iPhone > On Jul 13, 2023, at 4:24 PM, Bob Sneidar via use-livecode > wrote: > > I wrote a formatDate function years ago that called this "sql date". Maybe I > should rename it “IS

Re: Convert date

2023-07-13 Thread Bob Sneidar via use-livecode
I wrote a formatDate function years ago that called this "sql date". Maybe I should rename it “ISO Date” or just add a case for it. There is also an “sql time” format in the function formatTime. This way you can put format date(the date, “sql date”) && formative(the time, “sql time”) to get an s

Convert date

2023-07-13 Thread Neville Smythe via use-livecode
I seem to have hallucinated that the built-in convert handler recognised the ISO date and dateTime formats (-MM-DD, -MM-DD hh:mm:ss+-hh.ss, etc) but I must have written my own conversion routines in a former life. But one would have to ask… Why doesn’t it? After all, the original ISO 860

Re: Convert date to seconds

2013-07-18 Thread Dar Scott
Yikes. I sent off something before seeing this. Well, maybe it is helpful. And it was scathing! Well, not really. I don't know how to do scathing and have no inclination, anyway. Dar On Jul 18, 2013, at 12:02 PM, Andrew Kluthe wrote: > disregard, after looking more closely at his email da

Re: Convert date to seconds

2013-07-18 Thread Dar Scott
We might be saying the same thing, but I'm not sure. on mouseUp get the short date convert it to seconds put it & tab & it/3600 mod 24 end mouseUp gives me this: 1374127200 6 I'm in MDT (Rocky Mountains), somebody in California might take those same seconds and convert to a short

Re: Convert date to seconds

2013-07-18 Thread Andrew Kluthe
disregard, after looking more closely at his email dar is correct completely. On Thu, Jul 18, 2013 at 1:01 PM, Andrew Kluthe wrote: > it gets midnight UTC, livecode changing the date FROM the time zone > independent seconds gives you time zone differences. > > > On Thu, Jul 18, 2013 at 12:48 PM

Re: Convert date to seconds

2013-07-18 Thread Andrew Kluthe
it gets midnight UTC, livecode changing the date FROM the time zone independent seconds gives you time zone differences. On Thu, Jul 18, 2013 at 12:48 PM, Dar Scott wrote: > I think it is the UTC seconds thing. I think that changing a date to > seconds will get midnight of the day for the curr

Re: Convert date to seconds

2013-07-18 Thread Dar Scott
I think it is the UTC seconds thing. I think that changing a date to seconds will get midnight of the day for the current time zone. Somebody in an more westerly timezone might see those seconds and the date will be earlier. If it is on only one computer and the timezone will not change, the

Re: Convert date to seconds

2013-07-18 Thread Klaus major-k
Hi Tom, Am 18.07.2013 um 17:56 schrieb Thomas McGrath III : > That's weird. I still get the 16th. Can anyone else confirm the 15th? (not > doubting you Dar) > I might have to change this then… I think you can simply add two hours (2*600) to the resulting seconds and are safe :-) > Tom > > --

Re: Convert date to seconds

2013-07-18 Thread Andrew Kluthe
I do believe the seconds that are given at any time by livecode are timezone agnostic (utc?) but livecode uses your system's settings to do conversions. For instance, the seconds livecode spits out for me at eleven pm of the 15th in the central standard timezone would put the same second number as

Re: Convert date to seconds

2013-07-18 Thread Thomas McGrath III
That's weird. I still get the 16th. Can anyone else confirm the 15th? (not doubting you Dar) I might have to change this then… Tom -- Tom McGrath III http://lazyriver.on-rev.com mcgra...@mac.com On Jul 18, 2013, at 12:39 AM, Dar Scott wrote: > > On Jul 17, 2013, at 7:03 PM, Thomas McGrath I

Re: Convert date to seconds

2013-07-17 Thread Dar Scott
On Jul 17, 2013, at 7:03 PM, Thomas McGrath III wrote: > I am converting the short date (08/16/13) to seconds and I get 1376625600 When I converted it back earlier today, I got the 15th. I guess there is a problem related to timezones or something. Consider NAMEmmdd. It is easy to pars

Re: Convert date to seconds

2013-07-17 Thread Mike Bonner
Oh cool. Looked it up! And yep, they do! So its a tie! On Wed, Jul 17, 2013 at 8:34 PM, Mike Bonner wrote: > GMTA? Did that mean I won?!?!?! *cough* > > > On Wed, Jul 17, 2013 at 8:25 PM, Mark Wieder wrote: > >> Mike- >> >> Wednesday, July 17, 2013, 6:53:41 PM, you wrote: >> >> > Could work u

Re: Convert date to seconds

2013-07-17 Thread Mike Bonner
GMTA? Did that mean I won?!?!?! *cough* On Wed, Jul 17, 2013 at 8:25 PM, Mark Wieder wrote: > Mike- > > Wednesday, July 17, 2013, 6:53:41 PM, you wrote: > > > Could work up a simple regex and use matchtext instead to remove the > issue > > entirely also. > > Ha! GMTA > > -- > -Mark Wieder > m

Re: Convert date to seconds

2013-07-17 Thread Mark Wieder
Mike- Wednesday, July 17, 2013, 6:53:41 PM, you wrote: > Could work up a simple regex and use matchtext instead to remove the issue > entirely also. Ha! GMTA -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.r

Re: Convert date to seconds

2013-07-17 Thread Mark Wieder
Tom- Wednesday, July 17, 2013, 6:03:26 PM, you wrote: > The reason I ask is I am making filenames by merging a name like > "Thomas" or "Tom" with the date converted to seconds as in > "Thomas1376625600.txt" or "Tom1376625600.txt" Regex to the rescue: get matchtext(tFileName, "([A-Za-z]+)([0-9]

Re: Convert date to seconds

2013-07-17 Thread Mike Bonner
t the length > of the seconds, and if it is eleven then modify your chunk stuff. > > > Craig Newman > > > > -Original Message- > From: Dar Scott > To: How to use LiveCode > Sent: Wed, Jul 17, 2013 9:21 pm > Subject: Re: Convert date to seconds > > > Wi

Re: Convert date to seconds

2013-07-17 Thread dunbarx
: Wed, Jul 17, 2013 9:21 pm Subject: Re: Convert date to seconds Will the create of file names be in the same time zone as the reader of file names? On Jul 17, 2013, at 7:03 PM, Thomas McGrath III wrote: > I am converting the short date (08/16/13) to seconds and I get 1376625600 > > My

Re: Convert date to seconds

2013-07-17 Thread Dar Scott
Will the create of file names be in the same time zone as the reader of file names? On Jul 17, 2013, at 7:03 PM, Thomas McGrath III wrote: > I am converting the short date (08/16/13) to seconds and I get 1376625600 > > My question is "Is the converted seconds always that many digits when > con

Re: Convert date to seconds

2013-07-17 Thread Mike Bonner
Since its the number of seconds since.. I think 1970, there will always be that many digits at least until the odometer rolls up to 99 + 1. Plenty of breathing space there. On Wed, Jul 17, 2013 at 7:03 PM, Thomas McGrath III wrote: > I am converting the short date (08/16/13) to seconds

Convert date to seconds

2013-07-17 Thread Thomas McGrath III
I am converting the short date (08/16/13) to seconds and I get 1376625600 My question is "Is the converted seconds always that many digits when converted from that type of date?" The reason I ask is I am making filenames by merging a name like "Thomas" or "Tom" with the date converted to secon