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 9266151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:15:08+00:00 2026-06-18T14:15:08+00:00

I need to convert the string Fri Sep 11 00:00:00 GMT+04:00 2020 into a

  • 0

I need to convert the string "Fri Sep 11 00:00:00 GMT+04:00 2020" into a DateTime object 11.09.2011.

When I use

DateTime result;
DateTime.TryParseExact(MyString, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy", 
    CultureInfo.InvariantCulture, DateTimeStyles.None, out result);

result is equal to {9/10/2020 11:00:00 PM}.

How can I modify the code so that the date component is 11.09.2011 and not 10.09.2011 (I only need the date and don’t care about the time) ?

  • 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-06-18T14:15:09+00:00Added an answer on June 18, 2026 at 2:15 pm

    Parse into a DateTimeOffset instead, given that you’ve got an offset. From the documentation of the zz specifier that you’re using:

    With DateTime values, the “zz” custom format specifier represents the signed offset of the local operating system’s time zone from UTC, measured in hours. It does not reflect the value of an instance’s DateTimeKind property. For this reason, the “zz” format specifier is not recommended for use with DateTime values.

    So you’d end up with:

    DateTimeOffset result;
    bool success = DateTimeOffset.TryParseExact
             (text, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy", 
              CultureInfo.InvariantCulture, DateTimeStyles.None, out result);
    

    From there, you can take the DateTime part, which will be midnight on September 11th.

    If you want just a date, you could use my Noda Time project to create a LocalDate:

    LocalDate = OffsetDateTime.FromDateTimeOffset(result).LocalDateTime.Date;
    

    (I’d love to suggest parsing directly to OffsetDateTime, but we haven’t got support for that yet. We’re hoping to include it in version 1.2.)

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

Sidebar

Related Questions

I need to convert this string date 2011-06-25T11:00:26+01:00 into a long like value. I
I need to convert a string time stamp value into Java Date object. The
I need to convert a String containing date into an date object. The String
I need to convert a string of text containing a long url into the
I need to convert a string to datetime . I need to store datetime
I need to convert my string date to datetime type. Here's one date scenario:
I need to convert a string like this: A &#039;quote&#039; is <b>bold</b> into: A
Please I need help on how to convert this string [ Fri Jun 19
Need to convert a string to normal datetime format so it can be correctly
I need to convert a string into it's binary equivilent and keep it in

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.