When a MAC routine is compiled it generates and compiles an INT routine. When an INT routine is compiled it generates an OBJ routine.
Here's one way to get the $H-style timestamp of when an OBJ was last written. In my example it's the OBJ of the RightTriangle.MAC example in the SAMPLES namespace:
You can also make use of %Library.Routine. As John pointed out a MAC routine will generate an INT routine, so if you have a situation where a MAC routine is saved but uncompiled you should check the INT code.
You can use the LastModifiedMethod(), here is an example
set myRoutine = ##class(%Routine).%OpenId("MyFavoriteRoutine.INT")
write myRoutine.LastModifiedMethod()
If you are working a lot with routines, %Library.Routine has more functionality which you might find useful.
In addition to the Terminal-based methods of getting the last compilation date, you can also use the Management Portal web browser UI.
If you go to Home -> System Explorer -> Routines, there is a UI that allows you to Search for your routine and display some information about it. The UI displays the Name, Compilation Date, and Size of the routine.
For example, when I searched for *test.mac, my routine was displayed with the following info:
When a MAC routine is compiled it generates and compiles an INT routine. When an INT routine is compiled it generates an OBJ routine.
Here's one way to get the $H-style timestamp of when an OBJ was last written. In my example it's the OBJ of the RightTriangle.MAC example in the SAMPLES namespace:
write $$DATE^%R("RightTriangle.OBJ")
Great...
You can also make use of %Library.Routine. As John pointed out a MAC routine will generate an INT routine, so if you have a situation where a MAC routine is saved but uncompiled you should check the INT code.
You can use the LastModifiedMethod(), here is an example
set myRoutine = ##class(%Routine).%OpenId("MyFavoriteRoutine.INT")
write myRoutine.LastModifiedMethod()
If you are working a lot with routines, %Library.Routine has more functionality which you might find useful.
In addition to the Terminal-based methods of getting the last compilation date, you can also use the Management Portal web browser UI.
If you go to Home -> System Explorer -> Routines, there is a UI that allows you to Search for your routine and display some information about it. The UI displays the Name, Compilation Date, and Size of the routine.
For example, when I searched for *test.mac, my routine was displayed with the following info:
----------------------------------------------------------------------
Name Date Size
Routinetest.mac 2016-11-15 11:24:03 26 Code (link to code)
-----------------------------------------------------------------------
Just make sure you're looking in the correct namespace/database.