Script to Generate Concurrent Times
Peter Haworth
pete at lcsql.com
Fri Jan 16 12:30:21 EST 2015
If, by chance, an SQLite database is involved in your application, its
strftime() function has a lot of very powerful date adjustment/conversion
tools which might help.
Even without an SQLite database in an application, I sometimes create an in
memory database just so I can issue SELECT statements to calculate dates
and times.
Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
On Thu, Jan 15, 2015 at 7:02 PM, Brahmanathaswami <brahma at hindu.org> wrote:
> Roger Eller wrote:
>
>> So that's where the old saying, "your singing would bring a jersey cow to
>> tears" comes from.<g>
>>
>
> LOL!
>
> Hmmm back on topic:
>
> Requirement: Generate current time list for a *future* time (for scheduled
> webinar)
>
> OK, so it is easy enough to get world time from the linux system.
>
> and FYI: LC "internet date" is, happily, using the standard RFC 2822
> format and we can invoke this also in the shell:
>
> -R, --rfc-2822
> output date and time in RFC 2822 format. Example: Mon, 07
> Aug
> 2006 12:34:56 -0600
>
> Check it out now
>
> http://dev.himalayanacademy.com/tests/dates.lc
> -----------
>
> ?lc
>
> # copied the list from html source at:
> # http://www.timezoneconverter.com/cgi-bin/tzc.tzc <
> http://www.timezoneconverter.com/cgi-bin/tzc.tzc>
>
> put url "file:/home/devhap/public_html/tests/zones.txt" into tZones
>
> repeat for each line x in tZones
> set the itemdel to "/"
> if (the number of items of x) = 1 then
> put x into tCity
> else
> put item 2 of x into tCity
> end if
> put x into $TZ
> put shell("date -R") into tDTstring
> put tCity& ": "& tDTstring& "<br />" after tWorldTimes
> end repeat
>
> put tWorldTimes
> -----------------
>
> but that doesn't actually meet my requirement.
> Sure: We get all the times to answer "what time is it now?"
>
> But what if I want to a future time e.g. February 1, 1:30PM HST
>
> and get a list of all dates/times across the globe that are concurrent
> with that future date/time?
>
> Maybe I'll ask that on Expert's Exchange... man timezone isn't getting me
> anything.
>
> I suppose one algorithm using LC native timedate conversion tools could be.
>
> (the future date in seconds) - (Current time in seconds local time) =
> advanceToFutureIncrement
>
> repeat for each concurrent time for now for all cities
> put (city[x] Time Right Now) + advanceToFutureIncrement into
> tFutureWebinarTimeInCity[x]
> put tFutureWebinarTimeInCity[x] & "<br />" after
> tListOfNextWebinarTimes
> end repeat
>
> of course the above needs a bit more code, but not much more...
>
> Brahmanathaswami
>
>
>
>
> _______________________________________________
> 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
>
More information about the use-livecode
mailing list