TinySite.Commands.ParseDocumentCommand.ParseDateTimeSmarter C# (CSharp) Method

ParseDateTimeSmarter() private static method

private static ParseDateTimeSmarter ( string value ) : DateTime?
value string
return DateTime?
        private static DateTime? ParseDateTimeSmarter(string value)
        {
            var match = SmarterDateTime.Match(value);

            if (match.Success)
            {
                var year = Convert.ToInt32(match.Groups[1].Value, 10);
                var month = Convert.ToInt32(match.Groups[2].Value, 10);
                var day = Convert.ToInt32(match.Groups[3].Value, 10);
                var hour = match.Groups[4].Success ? Convert.ToInt32(match.Groups[4].Value, 10) : 0;
                var minute = match.Groups[5].Success ? Convert.ToInt32(match.Groups[5].Value, 10) : 0;
                var second = match.Groups[6].Success ? Convert.ToInt32(match.Groups[6].Value, 10) : 0;

                return new DateTime(year, month, day, hour, minute, second);
            }

            DateTime dateTime;
            return DateTime.TryParse(value, out dateTime) ? (DateTime?)dateTime : null;
        }