Nothing in Trainzscript is easy.

Debugging tools are virtually non existent so you need to proceed incremental steps much like Andi's code in the WiKi tutorials. Those tutorials are actually out of date and need an update to match changes to the standard script libraries.
The only actual time function I know of is this function in the library script interface.gs. It's used in Andi's HelloWorld example. This is the definition:
Code:
//=============================================================================
// Name: GetTimeStamp
// Desc: Returns the current real-world time, represented as seconds elapsed
// since midnight (00:00:00), January 1, 1970, coordinated universal time
// (UTC). Note that the return value is a string as this value no longer
// fits in a signed 32 bit integer, and gsc does not support any extended
// integer types.
//=============================================================================
public native string GetTimeStamp(void);
The first problem is that it returns a string and, when I ran it in a test script, I got:
; <NULL> : Interface.Print> 'Hello World, Good Afternoon - 1704350844'
The string at the end is the number of seconds since Jan 1, 1970. That's a lot of seconds.
Your problem is that the string will need to be converted to an integer or float to do the necessary math to get whatever time values are of interest to you.
In your test code you need only reference world.gs and those existing constants/definitions will be available to you. I would probably:
1. Convert the string to something you can work with.
2. Calculate the year taking into account leap years.
3. Calculate the month and day.
4. Finally calculate the hours, mins and seconds.
Sounds like an exercise a first year software engineering student might be assigned.

Not especially difficult but tricky.
Here's some tips for you. Find the script libraries in your Trainz installation folder and take a copy of all the gs files and put them somewhere else to use as a reference. Making a copy is a good idea as examining those files could easily result in the file being changed. That can cause Trainz to crash.
When you are looking for functions/methods, those files will be more up to date than the corresponding WiKi pages. There is also more information in those files than on the WiKi pages.
There have been some substantial changes to base library scripts in TS19 and TS22 and relying on code made for earlier versions can result in errors for obsolete or deprecated functions/methods.
If are going to be serious about writing scripts then you should probably turn off compatibility mode in the Trainz settings while testing. Turn it back on when finished.