Beispiel #1
0
        public static DateTime Parse(string s, DateTime defaultValue)
        {
            s = MonthsInEnglish.CorrectAbbreviatedName(s);
            DateTime d;

            return(TryParse(s, out d) ? d : defaultValue);
        }
Beispiel #2
0
        public static DateTime ParseTime(string s, DateTime?dateValue = null, DateTime?defaultTime = null)
        {
            var def  = defaultTime ?? DateTime.MinValue;
            var date = dateValue ?? DateTime.MinValue;

            s = MonthsInEnglish.CorrectAbbreviatedName(s);
            DateTime time;

            if (!TryParse(s, out time))
            {
                time = def;
            }
            return(UniteDateAndTime(date, time));
        }