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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:06:48+00:00 2026-06-13T20:06:48+00:00

Frustrating problem with DateTime, we have a section with a date picker on and

  • 0

Frustrating problem with DateTime, we have a section with a date picker on and if the culture is set to en-GB and the date is 01/11/2012 (dd/mm/yyyy) and then the culture is swapped to Chinese (zh-CN) the date is passed in the old culture format and when it is converted to a DateTime the datetime becomes 2012/1/11 when the culture should be (yyyy/mm/dd).

This seems to be the only culture that I have come across where the conversion is going wrong as it should be 2012/11/1 as 11 is the month.

Does anyone have any ideas why it isn’t converting correctly?

Sorry guys this is my fault for not being clear enough, more detail needed.

We have a reporting form that allows users to select a date range, on that form we use use a date range picker (http://www.filamentgroup.com/lab/update_date_range_picker_with_jquery_ui/) to populate a readonly textbox that is submitted to filter the results. Users can select from a dropdown their current culture (needed for our users as they wanted to easily swap between English and Chinese without changing browser settings, If the culture is en-GB then the date range string may read “01/01/2012—01/11/2012” which is 1st January 2012 – 1st November 2012. This is stored in the url, e.g: &DateRange=01%2F01%2F2012+—+01%2F11%2F2012.

Now if the user swaps to Chinese it calls the current page with all the same query parameters but also with the culture parameter changed (we allow the culture to be overridden by an URL parameter) which means the dateformat 01/11/2012 is in the query string, when we pass this using:

DateTime.TryParse(endDateString, out endDate);

the DateTime object contains a date of 11th January 2012 instead of 1st November 2012.

Is there a way I could store the culture info that the date string is in and use that to convert to the new culture info if the culture is swapped?

Any better ideas would be greatly appreciated, swapping from en-GB to en-IN (India) seems to work fine as does swapping to es-MX (Mexico). It just seems to be chinese but that could be pot luck based on these languages date formats.

Many thanks for taking the time to read this.

  • 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-13T20:06:50+00:00Added an answer on June 13, 2026 at 8:06 pm
    DateTime.TryParse(endDateString, out endDate);
    

    is using whatever culture is default on the server.

    The basic solution would be:

    var ci = GetCultureInfoFromRequest();
    DateTime.TryParse(endDateString, out endDate, ci);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart
I've been dealing with a frustrating problem recently. I have a lot of reflection
Ok, I have a very frustrating problem. I am parsing a webpage and need
i have a frustrating problem with registering global hook. I am using this class
I have a frustrating problem. I'm building a view engine in ASP.NET MVC and
I have a peculiar and frustrating problem. For the simple markup: <table> <thead> <tr><th>1</th><th>2</th><th>3</th></tr>
I really need your help since I have a frustrating problem. I'm downloading data
Very frustrating problem I have here. I have this code: Button b = findViewById(android.R.id.button1);
I have a very frustrating problem which I cannot result. Its just not adding
I have a very frustrating problem: The $_POST values disappears when using pagination, I've

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.