現在位置: INDEXLSLユーザ関数日本時間取得

日本時間取得

over view

現在の日本時間をリスト形式で取得するユーザ関数

list uuGetJpTime();
  • 戻り値:list [year, month, day, hour, minute, second](リスト内の各要素は整数型)

code

// Get Japan Local Time & Date :: 2008-07-28
// --- modify :: 2010-11-21
list uuGetJpTime(){
    integer t = (integer)llGetGMTclock();
    integer hour = t / 3600 + 9;
    integer minute = (t % 3600) / 60;
    integer second = t % 60;
    string date = llGetDate();
    list raw_data = llParseString2List(date, ["-"], []);
    integer year = llList2Integer(raw_data, 0);
    integer month = llList2Integer(raw_data, 1);
    integer day = llList2Integer(raw_data, 2);
    list big_month = [1, 3, 5, 7, 8, 10, 12];
    list small_month = [4, 6, 9, 11];
    // Adjust Hour
   if (hour >= 24){
       hour -= 24;
       day ++;
    }
    // Adjust Date
    if (~llListFindList(big_month, [month]) && day > 31){
        day -= 31;
        month ++;
    }else if (~llListFindList(small_month, [month]) && day > 30){
        day -= 30;
        month ++;
    }else if (month == 2 && year % 4 != 0 && day > 28){
        day -= 28;
        month ++;
    }else if (month == 2 && year %4 == 0 && day > 29){
        day -= 29;
        month ++;
    }
    // Adjust Month
   if (month > 12){
       month -= 12;
       year ++;
    }
    // Return Data
    return [year, month, day, hour, minute, second];
}
最終更新: 2010年11月25日 02 : 18 by arz Nitely
http://arzNitely.com/lsl/user_function/uugetjptime/index.html

Copyright 2007-2010 ©arzNitely.com all right reserved

www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0