Azure’s REST API requires Date or x-ms-date header. As specified by HTTP protocol, the Date (or x-ms-date) header must be in RFC 1123 format.

Example of Date in RFC 1123 format

Wed, 09 Dec 2015 18:59:42 GMT

Converting DateTime to RFC 1123 in C#

In C# DateTime can be converted to RFC 1123 using the “r” format. Example:

var result = DateTime.Now.ToUniversalTime().ToString("r");

Web Tool

Perhaps the easiest way to get the current date time in RFC 1123 format is through the http://http-date.com/. This web tool, created by Leonard Wallentin, provides not just the current date time in correct format but also "30 days from now" and “365 days from now". The tool has proven itself really useful in the last few days when working with the Azure blobs using the REST API.