Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MonoHttpDate.cs « System.Net « System « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e7ebfe419f530c26e933e45357644b5df2d4fb6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// System.Net.MonoHttpDate
//
// Author:
//   Lawrence Pit (loz@cable.a2000.nl)
//

using System;
using System.Globalization;

namespace System.Net 
{
	/// <summary>
	/// See RFC 2068 3.3.1
	/// </summary>
	internal class MonoHttpDate
	{
		private static readonly string rfc1123_date = "r";
		private static readonly string rfc850_date = "dddd, dd-MMM-yy HH:mm:ss G\\MT";
		private static readonly string asctime_date = "ddd MMM d HH:mm:ss yyyy";
		private static readonly string [] formats = 
			new string [] {rfc1123_date, rfc850_date, asctime_date};
		private static readonly CultureInfo enUS = new CultureInfo("en-US", false);
		
		internal static DateTime Parse (string dateStr)
		{			
			 return DateTime.ParseExact (dateStr, 
			                             formats, 
			                             enUS, 
			                             DateTimeStyles.AllowWhiteSpaces);
		}
	}
}