• Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting a String to Calendar object  RSS feed

 
Help Me
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want in my program to convert a String to an object of the Calendar type. The setDateOfBirth method in the bean class expects a Calendar object. This is what I've done so far. When I try to compile the program, I'm getting the following error. Please help me out..

C:\projects>javac -d ./ *.java
AddCustomer.java:36: 'void' type not allowed here
custbean.setDateOfBirth(cal.setTime(dt));
^
1 error




Thanks,
Babu
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\projects>javac -d ./ *.java
AddCustomer.java:36: 'void' type not allowed here
custbean.setDateOfBirth(cal.setTime(dt));
^
1 error

The method setTime(...) in class Calendar does not return any value (it is a void method). In the line with the error you are trying to use the non-existent return value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!