Get the yaw and pitch of target lights and non-target lights ?

I was hoping to translate the values to yaw and pitch with no value for roll for lights that are rotated and target lights also (so the light to the lights target).

I'm not having much luck and my dossing in maths class is now coming back to bite me.

Here's some code I have written to print a non-target lights eularangles of the various orders to try see if any of the returned values will return what I'm after.

But sadly it didn't. In the code below the values are there for 3ds max and the other software.

/*
In the other software, the z-axis is up.
 
A non-target light in 3ds max vs what the other software shows.
 
x, y, z rotation    yaw, pitch
[0,0,0]             0,   -90
[0,90,0]            90,  0
[0,45,0]            90,  -135
 
*/
 
lightEuler = (normalize $.rotation.controller.value as eulerangles)
 
for i = 1 to 9 do
(newangle = eulerToQuat lightEuler order:i
  print (newangle as eulerangles)
  )

Needless to say, I'm having the same difficulty with the target lights as well.