Saturday, 16 September 2017

java - I have created a date using SimpleDateFormat, how do I convert into a string?

newDate =(newDaysAdded+"/"+month+"/"+year); 
SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy");
try {

Date newDateOne = date.parse(newDate);


When I try:



view.writeToScreen(newDateOne);


I get the error:




 Incompatible types: Date cannot be converted to String.


Here is the writeToScreen method:



void writeToScreen(String s);


However from there I can't turn into a string, I have tried:
String test = Date.toString(newDateOne);




Can anyone help?

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...