Get Server Time To Bukkit

Discussion in 'Plugin Development' started by Herpeto, Mar 31, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    I want create a clock on minecraft server, i want get REAL server time, but i dont know how can i get server time. anyone know how can i get server time? thanks and sorry for my bad language :)
  2. Offline


  3. Offline


    How about some Calendar?

    Calendar cal = Calendar.getInstance();
    int year = cal.get(Calendar.YEAR);
    int mon = cal.get(Calendar.MONTH)+1;
    int day = cal.get(Calendar.DAY_OF_MONTH);
    int hour = cal.get(Calendar.HOUR_OF_DAY);
    int min = cal.get(Calendar.MINUTE);
    int sec = cal.get(Calendar.SECOND);
    String am = cal.get(Calendar.AM_PM) == 0 ? "AM" : "PM";
    String time = String.format("%04d-%02d-%02d %02d:%02d:%02d %s", year, mon, day, hour, min, sec, am);

    That's scoreboard stuff. Don't think it has to do with clocks or the server time. :p
  4. Offline


    Herpeto sudah kejawab

    Scizzr Topic Starter will placing into Leaderborad

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page