Beispiel #1
0
 public static string GetText(ETimeFormatType type)
 {
     if (type == ETimeFormatType.ShortTime)
     {
         return("8:09");
     }
     if (type == ETimeFormatType.LongTime)
     {
         return("8:09:24");
     }
     throw new Exception();
 }
Beispiel #2
0
 public static string GetValue(ETimeFormatType type)
 {
     if (type == ETimeFormatType.ShortTime)
     {
         return("ShortTime");
     }
     if (type == ETimeFormatType.LongTime)
     {
         return("LongTime");
     }
     throw new Exception();
 }
Beispiel #3
0
 public static bool Equals(ETimeFormatType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Beispiel #4
0
        public static string GetTimeString(DateTime datetime, ETimeFormatType timeFormat)
        {
            var retval = string.Empty;

            if (timeFormat == ETimeFormatType.LongTime)
            {
                retval = datetime.ToLongTimeString();
            }
            else if (timeFormat == ETimeFormatType.ShortTime)
            {
                retval = datetime.ToShortTimeString();
            }
            return(retval);
        }
Beispiel #5
0
 public static string GetText(ETimeFormatType type)
 {
     if (type == ETimeFormatType.ShortTime)
     {
         return "8:09";
     }
     else if (type == ETimeFormatType.LongTime)
     {
         return "8:09:24";
     }
     else
     {
         throw new Exception();
     }
 }
Beispiel #6
0
 public static string GetValue(ETimeFormatType type)
 {
     if (type == ETimeFormatType.ShortTime)
     {
         return "ShortTime";
     }
     else if (type == ETimeFormatType.LongTime)
     {
         return "LongTime";
     }
     else
     {
         throw new Exception();
     }
 }
Beispiel #7
0
 public static bool Equals(string typeStr, ETimeFormatType type)
 {
     return(Equals(type, typeStr));
 }
Beispiel #8
0
 public static string GetDateAndTimeString(DateTime datetime, EDateFormatType dateFormat, ETimeFormatType timeFormat)
 {
     return($"{GetDateString(datetime, dateFormat)} {GetTimeString(datetime, timeFormat)}");
 }