1

I'm working on a java project and I need to send a date format within a URL but the container of date send it with spaces which is impossible so i convert it to a string and I used the replace method to replace the spaces with "" or "-" but it didn't work

Here is the code:

Date date = date_debut.getDate();
String dateconver= date.toString();
String datef= dateconver.replace(" ", "");

And here is the error: incompatible types string can not be converted to char

I have tried also to use replaceAll but the IDE didn't even show it

Ido Michael
  • 109
  • 7

1 Answers1

2

Try this code

Date date = date_debut.getDate();
String dateconver= date.toString();
String datef= dateconver.replaceAll("\\s", "");
Amar Ilindra
  • 923
  • 2
  • 11
  • 30