How do I get the current time of the phone?
Want to use it within an event but how would I get it? Thanks
How do I get the current time of the phone?
Want to use it within an event but how would I get it? Thanks
I want to take the current time, and add a value, so the value could be 25 hours could be 2 hours etc.
How can I get the time and add the value so it calculates the time + the value
So if its 5.00pm and I add 20 it will display the time as 1pm
You can use the Date & Time object to get the current time of the device(in hours for example).
I'm not sure what you want exactly.
You need the value to control the time of the phone or do you just want to synchronize your own clock in the game with the device time?
Can you explain in a bit more detail what event you're trying to create here?
I want a timer in the game to sync with the phone time, then be able to add to it.
So the user can add time on and the time will add to the timer.
So if its 8.20 am and the users clicks add 2 hours it will display 10.20
also the ability to show the day would also be good so displays monday, then if the clock passes 24.00 it will display the next day
This means you only need the phone time to sync hours/minutes/also seconds? + day with your game clock? And after syncing you don't need to check phone time again(except you wanna sync again) and your game clock is just running and you also need the ability to change the game time independently? Do you want this for a clock(with graphics) in your game? Can you explain how you display the time in your game actually?
I would make an example for you then.
yes i only need to current time once, then add a value to it.
i have been using counters to display the time in the game
not sure if this is the best thing to use
it only needs to use the current time as a base figure to start with then add to the time and calculate the time + the day of the week