0
Hello I have an Android application that takes the date of a Datepicker but I’m not able to convert it to the type accepted by MYSQL in the case Date how could do this?
0
Hello I have an Android application that takes the date of a Datepicker but I’m not able to convert it to the type accepted by MYSQL in the case Date how could do this?
0
You can change the global variables of your database to the format of your application, but I indicate some formatting of the application for the database, to keep the default, but if you want to change the database, the variables are the following and would be like this:
SET @@date_format = '%d/%m/%Y'; SET @@datetime_format = '%d/%m/%Y %H: %i:%s';
0
Dates in Mysql are 'YYYY-MM-DD' format and support a range from '1000-01-01' up to '9999-12-31'. Check if the date you are reporting is in this format and is valid. If you need to convert, use the Simpledateformat. Ex:
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
String dateFormat = dateformat.format(new Date(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()));
Browser other questions tagged android mysql date
You are not signed in. Login or sign up in order to post.
In this case you are converting the received date to String?
– fabricio b.
I was converting a date object. I updated the example, I think it will be simpler.
– Lucas Matias