public static EventTimeResult getTime(string source) { DateTimeRoutines.ParsedDateTime dateTime; if (DateTimeRoutines.TryParseTime(source, DateTimeRoutines.DateTimeFormat.USA_DATE, out dateTime)) { if (dateTime.IsTimeFound) { string rest = source.Substring(dateTime.IndexOfTime, dateTime.LengthOfTime); return(new EventTimeResult(dateTime.DateTime.ToShortTimeString(), rest, source)); } } return(new EventTimeResult("", "", source)); }
public string getTimeRange(string source) { string TO = String.Empty; string To_Use = source; if (FROM.Length == 0) { return("All Day"); } source = source.Replace(FROM, ""); source = source.Replace("-", ""); string toReal = ""; bool notFound = false; DateTimeRoutines.ParsedDateTime dt; if (DateTimeRoutines.TryParseTime(source, DateTimeRoutines.DateTimeFormat.USA_DATE, out dt)) { if (dt.IsTimeFound) { TO = dt.DateTime.ToShortTimeString(); toReal = source.Substring(dt.IndexOfTime, dt.LengthOfTime); } else { notFound = true; toReal = String.Empty; } } if (toReal.Length == 0) { return(REAL_TIME); } try { LONG_STRING = LONG_STRING.Replace(FROM, ""); LONG_STRING = LONG_STRING.Replace(toReal, ""); } catch (Exception ee) { } if (notFound) { return(REAL_TIME); } return(REAL_TIME + "-" + TO); }