User:Trinity Coulter/Using HTTPRequest to Convert Unix time to pretty time

From Second Life Wiki
Jump to navigation Jump to search

Neat little script to help with an overly complicated task in regular LSL.

<lsl> integer myUnixTime; default {

   state_entry()
   {
       llSay(0,"Touch to get current nice time from Unix time");
   }
   
   touch_start(integer total_number)
   {
       myUnixTime = llGetUnixTime();
       llHTTPRequest( "http://www.iwebtool.com/tool/tools/unix_time_converter/unix_time_converter.php?time=" + (string)myUnixTime,[HTTP_METHOD,"GET"],"");
   }
   
    http_response(key request_id,integer status, list metadata, string body)
   {
       body = llGetSubString(body, 50, -9);
       llSay(0,(string)myUnixTime + " converts to " + body);   
   }

} </lsl>