as_phinterval function

Convert an interval or datetime vector into a phinterval