I am having some issues converting timezones for some clocks. i have trolled the net for the answer but cant seem to get anything to work. what i am looking for is a simple solution to either covert time/date zones or a way to calculate them using the system time. here is what i have working so far to calculate local dates.
var MyFont: Font;
var test : int = 1;
var horizontal : int = 10;
var vertical : int = 10;
var tm : TextMesh = gameObject.GetComponent(TextMesh);
var timeString = System.DateTime.Now.ToString("hh:mm:ss");
var dateString = System.DateTime.Now.ToString("hh:mm MM/dd/yyyy");
var clockNameText = TextMesh;
function Update ()
hi all i will answer my own question…looked everywhere and just started mucking around with MonoDevelop until i found this answer with a little messing around. add the following changes and get the value of the float by dividing the time difference into 24 and your textmesh will show the accurate date. its not as elegant as i would like but its a working solution for now.
var timeDiff : float;
If you know the name of the Timezone, try this:
TimeZoneInfo est = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
DateTime targetTime = TimeZoneInfo.ConvertTime(System.DateTime.Now, est);
But you should test this, as I don’t know if this has a list of timezones on mobile or mac.
This would also handle daylight savings time etc…
If you just want to add an offset, you can do:
float hoursOffset = -5f;
Be aware that timezones are a pain in the you know where…