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

  • Home
  • SEARCH
  • 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 6710743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:03:26+00:00 2026-05-26T08:03:26+00:00

string dt = 10/25/2010 11:40:05 PM; var currentThread = Thread.CurrentThread.CurrentCulture; //ru-RU DateTime dateTime =

  • 0
string dt = "10/25/2010 11:40:05 PM";
var currentThread = Thread.CurrentThread.CurrentCulture; //ru-RU
DateTime dateTime = DateTime.Parse(dt); //Exception!

How to parse that dt?

UPDATE:
In my case DateTime can be represent as "25.10.2010 11:40:05" or "10/25/2010 11:40:05 PM"
Is these any “generic” method to parse it without changing CurrentCulture?

  • 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-26T08:03:27+00:00Added an answer on May 26, 2026 at 8:03 am

    Use a custom Date and Time format string, using either ParseExact or TryParseExact.

    DateTime dateTime;
    DateTime.TryParseExact(
                           dt, 
                           "MM/dd/yyyy hh:mm:ss tt", 
                           CultureInfo.InvariantCulture,
                           DateTimeStyles.None,
                           out dateTime
                          );
    

    The string cannot be parsed as a Russian DateTime representation since the Russian culture doesn’t use AM/PM, hence the use of the use of CultureInfo.InvariantCulture which is a US like culture (it represents no specific culture, but is modeled after the en-US one).

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

Sidebar

Related Questions

I am creating a datetime string that looks like this: 2010-07-15 11:54:21 And with
How can I parse fast a yyyy-mm-dd string (ie. 2010-10-14) into its year, month,
I have the following string: 2010-04-08T12:46:43+00:00 I want to convert that to: 8th April
My input string is '16-MAR-2010 03:37:04' and i want to store it as datetime.
How can I convert a date time string of the form Feb 25 2010,
string time = Job started: donderdag 6 mei 2010 at 20:00:02 var filterReg =
Why cannot IE parse this string as a Date object. var d = Date.parse(Fri
I have some code that tries to parse a date string. When I do
I have a case using TDictionary: var D: TDictionary<string, integer>; begin D := TDictionary<string,
I have this string... var myDate = November 15, 2010; .....and I need to

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.