Script to Generate Concurrent Times

Brahmanathaswami brahma at hindu.org
Wed Jan 14 21:15:07 EST 2015


Devin: thanks!

  "set the $TZ" a perfect little gift on this Happy Makara 
Sankranti/Thai Pongal.

Big feast day in India today, sun moved into Capricorn, celebrate the 
post monsoon harvest. Tomorrow we will decorate and worship our lovely 
New Jersey cows.

see:

http://dev.himalayanacademy.com/tests/dates.lc

"Sweet" - linux web server Cento OS6.2)

How easy is this....
------------------------
<?lc

# copied the list from html source at: 
http://www.timezoneconverter.com/cgi-bin/tzc.tzc
# stripped the html in BBEdit to save as plain text file
# This server lives in San Francisco and we just leave the box TZ set
# towhere it really is PST.  Other time zones are calculated from there.

put url "file:/home/devhap/public_html/tests/zones.txt" into tZones

repeat for each line x in tZones

# Extract the city  from each line and leave the rest

     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
          # or whatever time zone(s) you want to show
          # easy enough to allow the user to enter or pick their city and
          # add a little AJAX for them to fetch their own time, too...
         put shell("date") into tDTstring
         put tCity & ": " & tDTstring & "<br />" after tWorldTimes
end repeat

     put tWorldTimes

-----------------

but now... trick will be: if you want to set a time in advance and then 
get your list from that and not from the current moment?

put another way: this list is generated for this very moment at "box 
time" (PST)  but if  I want to set it to Future Webinar Date/Time  and 
fetch calculated the "World Times" based on that future date/time...

will need to think about that...

Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



Devin Asay wrote:
> In your .lc script do this:
>
> 	put "US/Mountain" into $TZ # or whatever time zone you want to show
> 	put shell("date") into tDTstring
>
> Setting the $TZ variable right before called the date command returns the date/time the specified timezone. At least it works on the on-rev servers.



More information about the use-livecode mailing list