helper for parsing date