Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 721251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:51:07+00:00 2026-05-14T05:51:07+00:00

I am trying to parse dates in RFC1123 format (Thu, 21 Jan 2010 17:47:00

  • 0

I am trying to parse dates in RFC1123 format (Thu, 21 Jan 2010 17:47:00 EST).

Here is what I tried but none worked:

DateTime Date = DateTime.Parse(dt);
DateTime Date = DateTime.ParseExact(dt, "r", null);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:51:07+00:00Added an answer on May 14, 2026 at 5:51 am

    Have you tried something like:

    string dateString, format;  
    DateTime result;
    CultureInfo provider = CultureInfo.InvariantCulture;
    
    dateString = "Thu, 21 Jan 2010 17:47:00 EST";
    format = "ddd, dd MMM yyyy hh:mm:ss EST";
    
    result = DateTime.ParseExact(dateString, format, provider);
    Console.WriteLine("{0} converts to {1}.", dateString, result.ToString());
    

    I haven’t tested it yet (will in a few moments)… but I believe that will do it for you.

    Edit: It seems that the problem is that RFC1123 states that the timezone should always be GMT… which is why r or R did not work as a format for you. The problem is the EST. The pattern above accounts for EST, but it is static so if you have any other timezone you might be in trouble. The best solution would be to go with the RFC1123 standard and go to GMT and it should solve your problem. If you can’t, let me know I might have a solution.

    Edit 2: This is not a complete solution but what it does it isolates the timezone and still allows you to parse it. The code doesn’t know the timezone that it is being presented with but you can throw any timezone abbreviation at it and it will parse the time. If you want to convert to GMT and then use r or R you can take the result of the regex match, put it against a lookup table (to see what the time offset it for that timezone abbreviation), then convert the time to GMT and parse from there. That would be a good solution but a little more work. Here’s the code:

    string dateString, format, pattern, tz;
    DateTime result;
    CultureInfo provider = CultureInfo.InvariantCulture;
    pattern = @"[a-zA-Z]+, [0-9]+ [a-zA-Z]+ [0-9]+ [0-9]+:[0-9]+:[0-9]+ (?<timezone>[a-zA-Z]+)";
    dateString = "Thu, 21 Jan 2010 17:47:00 EST";
    
    Regex findTz = new Regex(pattern, RegexOptions.Compiled);
    
    tz = findTz.Match(dateString).Result("${timezone}");
    
    format = "ddd, dd MMM yyyy HH:mm:ss " + tz;
    
    try
    {
        result = DateTime.ParseExact(dateString, format, provider);
        Console.WriteLine("Timezone format is: {0}", format);
        Console.WriteLine("{0} converts to {1}.", dateString, result.ToString());
    }
    catch (FormatException)
    {
        Console.WriteLine("{0} is not in the correct format.", dateString);
    }
    
        Console.ReadLine();
    

    Here is a list of UTC offsets for you if you would like to turn this into a timezone converter:

    Timezone Abbreviations with UTC offsets

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to Parse dates entered into a TextBox into a DateTime value but
I'm trying to parse dates with a given format and I've found this which
I am trying to convert the twitter post dates into datetime objects but for
Quick question: I'm trying to parse dates in the following format to their equivalent
How should I write the format of the dates I'm trying to parse when
I'm trying to parse dates with regex, using groups, but python is returning empty
I am trying to use strptime() to parse dates from a factor variable--but there
I am trying to parse a date that looks like this: 2010-04-05T17:16:00Z This is
Trying to parse some XML but apparently this is too much for a lazy
I'm trying to sort a list of dates, but I'm struggling with null dates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.