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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:52:34+00:00 2026-06-15T23:52:34+00:00

In our application, we build date selection menus based on month end dates that

  • 0

In our application, we build date selection menus based on month end dates that are determined programmatically. In the US, a date might be 12/31/2012. In France, it might be 31/12/2012 or it could be a slightly different format that I get from CultureInfo.

My question is this: If I have a string date such as 12/31/2012 that is generated by the application – how can I format it properly for the culture the application is being run in? I can’t convert the string to a date and then format it, because I don’t know ahead of time what culture the application is being run in and what constitutes a valid date. Am I going to have to parse the short date format to try to display the date properly?

  • 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-15T23:52:35+00:00Added an answer on June 15, 2026 at 11:52 pm

    I can’t convert the string to a date and then format it, because I don’t know ahead of time what culture the application is being run in

    Yes, you can. You can both parse it to a DateTime and format it using the current culture.

    VB.NET:

    Dim myDate As DateTime 
                 = DateTime.Parse("12/31/2012", CultureInfo.InvariantCulture)
    Dim cultureAwareShortDate As String =
                 = myDate.ToString("d", Thread.CurrentThread.CurrentUICulture)
    

    C#:

    var myDate = DateTime.Parse("12/31/2012", CultureInfo.InvariantCulture);
    var cultureAwareShortDate
                 = myDate.ToString("d", Thread.CurrentThread.CurrentUICulture);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

as part of our application i need to build component that will output code
As part of our web application's build process, I have set up our XSLT
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
We are using Mage.exe to generate our application's manifests as part of our build
We have a ASP.NET web application written in VB.NET where we build content programmatically
I'm trying to build an application that needs to lock down access to the
We use Wix to build an installer for our .NET application and are just
We have two TFS build servers (build controllers) available for our application. Builds are
Our project is using many static libraries to build the application. How can we
My development team is going to build a voice chat application. Our plan is

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.