How to get the servers hour and minute? The actual server, not the in game hour.
Thanks
Get server hour and minute?
Discussion in 'Rust Development' started by Rusty, Aug 10, 2015.
-
If you are want to get time from plugin you can call DateTime.Now.
-
date = DateTime.Now errors
and System.DateTime.Now returns nill -
DateTime date = DateTime.Now ?
What is your programming language? -
Sky = global.TOD_Sky.get_Instance()
time = Sky.Cycle.DateTime:ToString("HH:mm:ss")
I got this working -
[DOUBLEPOST=1439232344][/DOUBLEPOST] -
ok i got wrong, do u need the time you are whatching on your clock?
[DOUBLEPOST=1439232917][/DOUBLEPOST]In that case you need the next code:
local time = time.GetCurrentTime()
if you want only to have the hours, min and sec u will need to add :ToString("h:mm tt"), so it will be like this:
local time = time.GetCurrentTime():ToString("h:mm tt") -
local hou = time.GetCurrentTime():ToString("h:mm")
Returns the correct minutes but the hour is off by 4 hours, it doesnt match the machine's time. or does it not take in consideration the timezone offset? -
if you want your local time, add :ToLocalTime()
local hou = time.GetCurrentTime():ToLocalTime():ToString("h:mm") -
Solved, thank you very much!
-
Wulf Community Admin