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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:40:02+00:00 2026-05-28T00:40:02+00:00

I am looking for a way to set date format in either mm/dd/yyyy or

  • 0

I am looking for a way to set date format in either mm/dd/yyyy or dd/mm/yyyy . Setting culture for my pages based on ip sets the language of asp.net calendar in local language.
For eg: it works fine for US , Australia , Uk. But for countries like Saudi Arabia I want my calendar to be still in English and not its local language like Arabic.

I basically want my calendar to be in English but with the correct format.

Please have a look at the code.

P.S.,
This code works fine for India where they have “en” as TwoLetterISOLanguageName. But then I realised not all countries have “en”.

private static CultureInfo GetCultureInfo(UserSession currentUserSession, string userHostAddress)
        {
            try
            {
                string location = null;

                // use logged in user's configured location
                if (currentUserSession != null)
                {
                    location = currentUserSession.LocationString;
                }

                // fall back to IP address
                if (string.IsNullOrEmpty(location))
                {
                    string code = IPToCountry.GetCountry(userHostAddress);

                    if (code != null)
                    {
                        location = Config.Users.GetCountryByCode(code);
                    }
                }

                // find english culture for country, if it exists
                if (!string.IsNullOrEmpty(location))
                {
                    foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
                    {
                        try
                        {
                            if (ci.TwoLetterISOLanguageName == "en")
                            {
                                RegionInfo ri = new RegionInfo(ci.LCID);
                                if (location.Contains(ri.EnglishName))
                                    return ci;
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return 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-28T00:40:03+00:00Added an answer on May 28, 2026 at 12:40 am

    I’m not sure I understood your question correctly, but you can set explicitly the format for dates in a culture.

    Note that you need to clone a CultureInfo before being able to set the DateTimeFormat property.

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

Sidebar

Related Questions

I'm looking for a way to set the checked property based on an integer
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
In an ASP.NET project, I'm looking for a way to have a jQueryUI datepicker
I am looking for a way to set permissions on a virtual directory through
I am looking for a way to set a warning that the caller will
I've been looking for a way to set the driver preferences for chrome driver
Looking for the best way to set-up an iPhone project in XCode ... namely:
I am looking for the best or any way to set the Album Art
I'm looking for a way to get and set those oddball chunks in a
I'm looking for as simple way to create an identity set. I just want

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.