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

The Archive Base Latest Questions

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

My C# application have to read some date from MySQL database. Problem I have

  • 0

My C# application have to read some date from MySQL database. Problem I have is that format of date depends on system localisation settings.

My question is if is possible that I always get date in formats yyyy-MM-dd hh:mm:ss, and yyyy-MM-dd, no matter of localisation settings.

Thank you in advance!

  • 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:49:01+00:00Added an answer on May 28, 2026 at 12:49 am

    If you are storing the dates as true date or datetime values, your application will get the raw binary data back, and it will not be subject to localization until you create a string representation of the date values. My guess is that you are looking at the values in the debugger or using Console.WriteLine(theValue);, which will use the current locale. Always include the desired format and/or the desired culture when converting non-string values to strings.

    If you are storing the dates as strings, you will always have to know exactly what format went into the database.

    Assuming the dates are stored as date or datetime: just handle the values as they are, and don’t convert them to strings until you need to show them to a user:

    DateTime theValue = theReader.GetDateTime(fieldOrdinal);
    var theValueAsText = theValue.ToString(CultureInfo.InvariantCulture);
    var specificTextRepr = theValue.ToString("yyyy-MM-dd HH:mm:ss");
    

    The theValueAsText variable will be a string representation that is not tied to a specific culture. The specificTextRepr will be your specific text representation.

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

Sidebar

Related Questions

I have read from some article that say's Apple doesn't approve the application which
In the database, I have a definition table that is read from the application
I have read some web site that captcha is not needed in mobile application.
I have read in Patterns of Enterprise Application Architecture that a Unit Of Work
I have read that viewstate is not there in asp.net MVC application. I am
Now that I have a read-only application working, I am working on the insert
I have an vCard application that needs to read vCard Data, and have found
We have a J2ME application that needs to read hex numbers. The application is
I have a project I'm working on that requires our WPF application read SMS
We have a big winforms C# application, that's basically a frontend for some databases

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.