[LibGDX][SOLVED] it's possible get the time?

I’m developing a game, and i want that the day time is the same in the game, so if it’s night were you live it’s the same in the game.
My question is, how can i get the day time in libgdx? And is the same for getting the time for pc and for android?
thanks in advice for your answer! ;D

ok, i find it! I use this to get the hours of the day :

Calendar.getInstance().get(Calendar.HOUR_OF_DAY));

I hope this can be helpfull :smiley:

Well this is pretty simple to be done in java. You just need to get the Systemtime and calculate the hours/minutes/seconds from it:


long time = System.nanoTime();
long seconds = time / 1E9;
long minutes = seconds / 60;
long hours = minutes / 60;

This should give you the current time split in hours/minutes and seconds :).

Edit: Well you got the other solution by using Calendar :smiley: