On the outset I thought absolutely not: you can not get credit for time served in one state for a sentence in another state.  But really there are exceptions to that very obvious - or so I thought - rule.  In Wisconsin, for instance, if you are picked up for an outstanding warrant from another state and jailed because of it then when you are sentenced in the other state for the crime that the warrant was issued you will indeed be given time served.  So it really depends on the connection between the warrant and the time served and the state in which the warrant was issued.  Here you also added to the mix the fact that he was "detained" in New York.  Hummm.....  I think that you should speak with an attorney in your area to sort this out.  Good luck.