Problem with Convert

Pete pete at mollysrevenge.com
Sun Feb 5 02:04:17 EST 2012


Thanks Ken.  I read the notes on the bug you cited andI think what I
experienced is a different problem.  I'm seeing empty in the dateitems, not
an unexpected month/day number. Even if it is a doc bug, I don't see any
changes in the dictionary that gives me any clue that what I was doing
would only work on a US system.

If LC was assuming a US date, it should still have returned a valid
dateitems string, albeit an incorrect one.  That would depend on what the
date actually was of course.  Taking  today,Feb 4 2012, as an example and a
system configured for UK dates, the dateitems should come back as they
would for April 2, 2012 (flipping the month number and day number) but
instead they came back as empty.

In fact, this problem originated on a Mac in Canada where I think they use
the same date format as the USA, yet the dateitems were returned as empty.

I fixed the problem by specifying the english date instead of the system
date. This code is part of the demo expiration checking in my product so it
has to work 100% reliably on any computer anywhere in the world and to be
honest, I'm still nervous about that being the case even with the english
date.  Maybe I should use the <from format> option on convert as you
suggested, or even change the way I check by using the seconds somehow.
 They couldn't mess up the seconds, could they?

Pete

On Sat, Feb 4, 2012 at 9:29 PM, Ken Ray <kray at sonsothunder.com> wrote:

>
> On Feb 4, 2012, at 4:33 PM, Pete wrote:
>
> > I just ran into what is either a bad misunderstanding on my part or a
> bug.
>
> Pete, see Bug #9893 in Bugzilla:
> http://quality.runrev.com/show_bug.cgi?id=9893
>
> It's actually a misunderstanding and not a bug… here's the reason:
>
> When you do:
>
>    convert the system date to dateItems
>
> LC reacts to this by interpreting the syntax as:
>
>    convert <date> to dateItems
>
> Even though you provided "the system date" as what to be converted, it
> would be the equivalent of:
>
>   put the system date into tDate
>   convert tDate to dateItems
>
> Since you aren't telling LC what to convert *from*, it assumes that what
> it is converting is a US date. Using my example above, you'd need to do:
>
>   put the system date into tDate
>   convert tDate from system date to dateItems
>
> So, although it may seem weird, using your original statement you'd need
> to do:
>
>   convert the system date from system date to dateItems
>
> The bug I mentioned above was originally posted by me as a functional bug,
> but what it turned into was a documentation bug…
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list