Beispiel #1
0
        internal static bool TryParse(string text, XsdDateTimeFlags kinds, out XsdDateTime result)
        {
            Parser parser = new Parser();

            if (!parser.Parse(text, kinds))
            {
                result = new XsdDateTime();
                return(false);
            }
            result = new XsdDateTime(parser);
            return(true);
        }
Beispiel #2
0
 /// <summary>
 /// Compares two DateTime values, returning an integer that indicates
 /// their relationship.
 /// </summary>
 public static int Compare(XsdDateTime left, XsdDateTime right)
 {
     if (left._extra == right._extra)
     {
         return(DateTime.Compare(left._dt, right._dt));
     }
     else
     {
         // Xsd types should be the same for it to be comparable
         if (left.InternalTypeCode != right.InternalTypeCode)
         {
             throw new ArgumentException(string.Format(ResXml.Sch_XsdDateTimeCompare, left.TypeCode, right.TypeCode));
         }
         // Convert both to UTC
         return(DateTime.Compare(left.GetZuluDateTime(), right.GetZuluDateTime()));
     }
 }