Added a convenience toTime function