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

  • Home
  • SEARCH
  • 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 1058149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:58:49+00:00 2026-05-16T17:58:49+00:00

I want to change the DateTime for MySQL in C#. My MySQL database only

  • 0

I want to change the DateTime for MySQL in C#.

My MySQL database only accept this format 1976-04-09 22:10:00.

In C# have a string who have a date value:

string str = "12-Apr-1976 22:10";

I want to convert for MySQL then it look like:

1976-04-12 22:10

How I can change them or how other programmer do this by using dd mm hh yy method? Can anyone tell me about them?

  • 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-16T17:58:49+00:00Added an answer on May 16, 2026 at 5:58 pm

    Keep in mind that you can hard-code ISO format

    string formatForMySql = dateValue.ToString("yyyy-MM-dd HH:mm:ss");
    

    or use next:

    // just to shorten the code
    var isoDateTimeFormat = CultureInfo.InvariantCulture.DateTimeFormat;
    
    // "1976-04-12T22:10:00"
    dateValue.ToString(isoDateTimeFormat.SortableDateTimePattern); 
    
    // "1976-04-12 22:10:00Z"    
    dateValue.ToString(isoDateTimeFormat.UniversalSortableDateTimePattern)
    

    and so on

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

Sidebar

Related Questions

I have a DateTime variable: DateTime date = DateTime.Now; I want to change the
I have a text file where I want to change only the first line
Hey all, I want to change a value in a table (in a mysql
I am getting the Unable to convert MySQL date/time value to System.DateTime error because
I want to change this code from MVC2 <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<System.DateTime?> %> <%=Html.TextBox(,
In my SQL Server database schema I have a data table with a date
I have an application that currently stores timestamps in MySQL DATETIME and TIMESTAMP values.
I want to write into a mysql database a timestamp in real milliseconds (I
On my html page I want to change the colour of the date when
I want to create an abstract class in C#. Currently, I have this class

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.