About Date in MySQL

1

I'm doing a program for a college job, with a connection to the database.

In a table, I have a NASCIMENTO column of type DATE . In the program I have a MaskedTextBox to insert the date of birth, however I put our dates means, DD/MM/YYYY , and in the database the default is YYYY/MM/DD , how do I convert this? Because I am not able to insert the data, due to the difference.

Would it be better to convert within the INSERT of the procedure in the bank or do by C #?

Example: I entered the date 12/04/1992, it has to be turned into 1992/12/04 to be stored in the bank.

    
asked by anonymous 22.04.2017 / 03:38

2 answers

1

The MySQL default is AAAA/MM/DD , so you'd ideally convert it to INSERT of C #, which would give you greater portability between banks, since that default is almost for all banks.

    
22.04.2017 / 06:02
0

Well, you can convert with C #

DateTime dt = DateTime.ParseExact("04/26/2016", "MM/dd/yyyy", CultureInfo.InvariantCulture);

I recommend researching your questions better before asking in the community, so as not to be negative and help keep the community's focus on questions not yet resolved.

link

    
23.04.2017 / 04:42