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?
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?
1
You can use Simpledateformat to do this.
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
String formatedDate = dateFormat.format( date );
You can read more about here: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
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 java mysql
You are not signed in. Login or sign up in order to post.
What have you tried? What is the origin of the data?
– user28595
java.text.Simpledateformat sdf = new java.text.Simpledateformat("yy-MM-dd HH:mmm:ss");
– learner
your pass would be save in Mysql database?
– R.Santos