Getting the current real life time?

I’ve looked a bit in the scripting reference manual, especially around the Time class. I’m looking to find a way to get the current real life time, for example the time of the clock on the computer, like 14:34, or even just time of the day in seconds. All I could found was “time since game start”, which is not what i want. Any ideas?

Don’t forget that you also have the Mono system libraries at hand (mostly an implementation of .NET 3.5). There is a structure under the System namespace called DateTime, with it a member called Now which returns a DateTime structure of the current time. So, in code:

// in C#
using System;
DateTime now = DateTime.Now;

// in JavaScript (forgive me if this is wrong, I don't use JS often)
var now : System.DateTime;
now = System.DateTime.Now;

For more information to the DateTime structure, refer to the .NET library documentation over here or the Mono System library documentation over here.

Took me a bit to remember how to do this…this next bit of code will basically create a variable of Type DateTime (available under the System namespace - not System.Collections) and then output the time to the console. You can do alot with this class and any objects instantiated from it, so you play around with the formatting til you get something you can use.

System.DateTime myTime =  System.DateTime.Now;