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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:13:49+00:00 2026-05-26T12:13:49+00:00

My website is hosted on multiple servers at different locations Everywhere the Culture of

  • 0

My website is hosted on multiple servers at different locations

Everywhere the Culture of the data format is different- we use mm/dd/yyyy format every where but incase some server has the culture set to dd/mm/yyyy then our website generates Datetime exception.

  • 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-26T12:13:50+00:00Added an answer on May 26, 2026 at 12:13 pm

    You should be specifying what culture you want to use whenever you convert a string to a date.

    The culture you should be using depends on what culture the dates are formatted as. For example, if all dates you are parsing are formatted as Slovak:

    String s = "24. 10. 2011";
    

    Then you need to parse the string as though it were in Slovak (Slovakia) (sk-SK) culture:

    //Bad:
    d = DateTime.Parse(s);
    
    //Good:
    d = DateTime.Parse(s, CultureInfo.CreateSpecificCulture("sk-SK")); //Slovak (Slovakia)
    

    If your dates are all in Tajik (Tajikistan Cyrillic), then you need to parse it as tg-Cryl-Tj:

    String s = "24.10.11"
    
    DateTime d = DateTime.Parse(s, CultureInfo.CreateSpecificCulture("tg-Cryl-Tj"));
    

    Which leads to the question: what date format are you using? You should not be relying on the locale setting of the server, you should be deciding what format you want.

    //Bad
    String s = d.ToString();
    
    //Good
    String s = d.ToString(CultureInfo.CreateSpecificCulture("si-LK")); //Sinhala (Sri Lanka)
    
    //s = "2011-10-24 12:00:00 පෙ.ව."
    

    i suspect that you prefer to do everything in English. But then you have to decide which variant of English:

    • en-AU (English Austrailia): 24/10/2011
    • en-IA (English India): 24-10-2011
    • en-ZA (English South Africa): 2011/10/24
    • en-US (English United States): 10/24/2011

    i suspect you prefer English (India) (en-IA).


    But if you really can’t decide what culture to use when converting dates to strings and vice-versa, and the dates are never meant to be shown to a user, then you can use the Invariant Culture:

    String s = "10/24/2011" //invariant culture formatted date
    
    d = DateTime.Parse(s, CultureInfo.InvariantCulture); //parse invariant culture date
    
    s = d.ToString(CultureInfo.InvariantCulture); //convert to invariant culture string
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website hosted with godaddy. Basically for my work I use TFS.
Scenario: The website is hosted on three servers using IIS on each. All three
I have an ASP.NET website hosted on GoDaddy. I need to redirect (301) every
I've got a static, test version of my website hosted here: http://alexgolec.staticloud.com/ but when
I have a website hosted on GoDaddy windows servers. I want to move the
I'm using PEAR on a hosted website and I want to use the MDB2
I have a website hosted on lighttpd, accessible at the www subdomain. I also
I have a internal website hosted on IIS. I added the following meta code
I have a website hosted on a Linux server. If someone sends me an
I have a small website hosted by my university. The policy is that no

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.