当前位置: 首页>>代码示例>>C#>>正文


C# DateTimeFormatInfo.GetAllDateTimePatterns方法代码示例

本文整理汇总了C#中System.Globalization.DateTimeFormatInfo.GetAllDateTimePatterns方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeFormatInfo.GetAllDateTimePatterns方法的具体用法?C# DateTimeFormatInfo.GetAllDateTimePatterns怎么用?C# DateTimeFormatInfo.GetAllDateTimePatterns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Globalization.DateTimeFormatInfo的用法示例。


在下文中一共展示了DateTimeFormatInfo.GetAllDateTimePatterns方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDateWordsOfDTFI

        [System.Security.SecurityCritical] // auto-generated
        #endif
        internal String[] GetDateWordsOfDTFI(DateTimeFormatInfo dtfi) {
            // Enumarate all LongDatePatterns, and get the DateWords and scan for month postfix.
            String[] datePatterns = dtfi.GetAllDateTimePatterns('D');
            int i;
            
            // Scan the long date patterns
            for (i = 0; i < datePatterns.Length; i++)
            {
                ScanDateWord(datePatterns[i]);
            }     

            // Scan the short date patterns
            datePatterns = dtfi.GetAllDateTimePatterns('d');
            for (i = 0; i < datePatterns.Length; i++)
            {
                ScanDateWord(datePatterns[i]);
            }
            // Scan the YearMonth patterns.
            datePatterns = dtfi.GetAllDateTimePatterns('y');
            for (i = 0; i < datePatterns.Length; i++)
            {
                ScanDateWord(datePatterns[i]);
            }                 

            // Scan the month/day pattern
            ScanDateWord(dtfi.MonthDayPattern);
            
            // Scan the long time patterns.
            datePatterns = dtfi.GetAllDateTimePatterns('T');
            for (i = 0; i < datePatterns.Length; i++)
            {
                ScanDateWord(datePatterns[i]);
            }                 

            // Scan the short time patterns.
            datePatterns = dtfi.GetAllDateTimePatterns('t');
            for (i = 0; i < datePatterns.Length; i++)
            {
                ScanDateWord(datePatterns[i]);
            }                 

            String[] result = null;
            if (m_dateWords != null && m_dateWords.Count > 0)
            {
                result = new String[m_dateWords.Count];
                for (i = 0; i < m_dateWords.Count; i++)
                {
                    result[i] = m_dateWords[i];
                }
            }
            return (result);
        }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:54,代码来源:DateTimeFormatInfoScanner.cs

示例2: GetAllDateTimes

 internal static String[] GetAllDateTimes(DateTime dateTime, char format, DateTimeFormatInfo dtfi)
 {
     Contract.Requires(dtfi != null);
     String [] allFormats    = null;
     String [] results       = null;
     
     switch (format)
     {
         case 'd':
         case 'D':                            
         case 'f':
         case 'F':
         case 'g':
         case 'G':
         case 'm':
         case 'M':
         case 't':
         case 'T':                
         case 'y':
         case 'Y':
             allFormats = dtfi.GetAllDateTimePatterns(format);
             results = new String[allFormats.Length];
             for (int i = 0; i < allFormats.Length; i++)
             {
                 results[i] = Format(dateTime, allFormats[i], dtfi);
             }
             break;
         case 'U':
             DateTime universalTime = dateTime.ToUniversalTime();
             allFormats = dtfi.GetAllDateTimePatterns(format);
             results = new String[allFormats.Length];
             for (int i = 0; i < allFormats.Length; i++)
             {
                 results[i] = Format(universalTime, allFormats[i], dtfi);
             }
             break;                
         //
         // The following ones are special cases because these patterns are read-only in
         // DateTimeFormatInfo.
         //
         case 'r':
         case 'R':
         case 'o':
         case 'O':
         case 's':
         case 'u':            
             results = new String[] {Format(dateTime, new String(new char[] {format}), dtfi)};
             break;   
         default:
             throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
         
     }
     return (results);
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:54,代码来源:DateTimeFormat.cs

示例3: GetDateWordsOfDTFI

 internal string[] GetDateWordsOfDTFI(DateTimeFormatInfo dtfi)
 {
     int num;
     string[] allDateTimePatterns = dtfi.GetAllDateTimePatterns('D');
     for (num = 0; num < allDateTimePatterns.Length; num++)
     {
         this.ScanDateWord(allDateTimePatterns[num]);
     }
     allDateTimePatterns = dtfi.GetAllDateTimePatterns('d');
     for (num = 0; num < allDateTimePatterns.Length; num++)
     {
         this.ScanDateWord(allDateTimePatterns[num]);
     }
     allDateTimePatterns = dtfi.GetAllDateTimePatterns('y');
     for (num = 0; num < allDateTimePatterns.Length; num++)
     {
         this.ScanDateWord(allDateTimePatterns[num]);
     }
     this.ScanDateWord(dtfi.MonthDayPattern);
     allDateTimePatterns = dtfi.GetAllDateTimePatterns('T');
     for (num = 0; num < allDateTimePatterns.Length; num++)
     {
         this.ScanDateWord(allDateTimePatterns[num]);
     }
     allDateTimePatterns = dtfi.GetAllDateTimePatterns('t');
     for (num = 0; num < allDateTimePatterns.Length; num++)
     {
         this.ScanDateWord(allDateTimePatterns[num]);
     }
     string[] strArray2 = null;
     if ((this.m_dateWords != null) && (this.m_dateWords.Count > 0))
     {
         strArray2 = new string[this.m_dateWords.Count];
         for (num = 0; num < this.m_dateWords.Count; num++)
         {
             strArray2[num] = (string) this.m_dateWords[num];
         }
     }
     return strArray2;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:40,代码来源:DateTimeFormatInfoScanner.cs

示例4: GetAllDateTimes

        internal static string[] GetAllDateTimes(DateTime dateTime, char format, DateTimeFormatInfo dtfi)
        {
            string[] allDateTimePatterns = null;
            string[] strArray2 = null;
            switch (format)
            {
                case 'D':
                case 'F':
                case 'G':
                case 'M':
                case 'T':
                case 'd':
                case 'f':
                case 'g':
                case 'Y':
                case 'm':
                case 't':
                case 'y':
                    allDateTimePatterns = dtfi.GetAllDateTimePatterns(format);
                    strArray2 = new string[allDateTimePatterns.Length];
                    for (int i = 0; i < allDateTimePatterns.Length; i++)
                    {
                        strArray2[i] = Format(dateTime, allDateTimePatterns[i], dtfi);
                    }
                    return strArray2;

                case 'O':
                case 'R':
                case 'o':
                case 'r':
                case 's':
                case 'u':
                    return new string[] { Format(dateTime, new string(new char[] { format }), dtfi) };

                case 'U':
                {
                    DateTime time = dateTime.ToUniversalTime();
                    allDateTimePatterns = dtfi.GetAllDateTimePatterns(format);
                    strArray2 = new string[allDateTimePatterns.Length];
                    for (int j = 0; j < allDateTimePatterns.Length; j++)
                    {
                        strArray2[j] = Format(time, allDateTimePatterns[j], dtfi);
                    }
                    return strArray2;
                }
            }
            throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:DateTimeFormat.cs

示例5: GetAllDateTimes

		internal static string[] GetAllDateTimes(DateTime dateTime, char format, DateTimeFormatInfo dtfi)
		{
			string[] array = null;
			string[] allDateTimePatterns;
			if (format <= 'U')
			{
				switch (format)
				{
					case 'D':
					case 'F':
					case 'G':
					{
						break;
					}
					case 'E':
					{
						goto IL_153;
					}
					default:
					{
						switch (format)
						{
							case 'M':
							case 'T':
							{
								break;
							}
							case 'N':
							case 'P':
							case 'Q':
							case 'S':
							{
								goto IL_153;
							}
							case 'O':
							case 'R':
							{
								goto IL_127;
							}
							case 'U':
							{
								DateTime dateTime2 = dateTime.ToUniversalTime();
								allDateTimePatterns = dtfi.GetAllDateTimePatterns(format);
								array = new string[allDateTimePatterns.Length];
								for (int i = 0; i < allDateTimePatterns.Length; i++)
								{
									array[i] = DateTimeFormat.Format(dateTime2, allDateTimePatterns[i], dtfi);
								}
								return array;
							}
							default:
							{
								goto IL_153;
							}
						}
						break;
					}
				}
			}
			else
			{
				if (format != 'Y')
				{
					switch (format)
					{
						case 'd':
						case 'f':
						case 'g':
						{
							break;
						}
						case 'e':
						{
							goto IL_153;
						}
						default:
						{
							switch (format)
							{
								case 'm':
								case 't':
								case 'y':
								{
									break;
								}
								case 'n':
								case 'p':
								case 'q':
								case 'v':
								case 'w':
								case 'x':
								{
									goto IL_153;
								}
								case 'o':
								case 'r':
								case 's':
								case 'u':
								{
									goto IL_127;
//.........这里部分代码省略.........
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:101,代码来源:DateTimeFormat.cs


注:本文中的System.Globalization.DateTimeFormatInfo.GetAllDateTimePatterns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。