Creating a Mysql default date string from a Java Date

Asked

Viewed 73 times

1

I need to pass a string in this format: "yyyy-mm-dd+HH:mm:ss" (where "+" should be a space) to a webservice from a Java Date object. How can I do that?

  • What have you tried? What is the origin of the data?

  • java.text.Simpledateformat sdf = new java.text.Simpledateformat("yy-MM-dd HH:mmm:ss");

  • your pass would be save in Mysql database?

2 answers

1

0


you can do with the SimpleDateFormat, however if you are passing the date to be formatted in "dd/MM/yyyy" mode and are trying to pass to a web service, SimpleDateFormat cannot format. I recommend changing "/" to "-".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.