You are using a format string that applies to a Calendar instance with int parameters. If you already have the hours and minutes as int, use String.format("%d:%d", hours, minutes); instead.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
What is the datatype of hours, minutes variables?
As per java documentation the syntax of String.format is ...
public static String format(String format,Object... args)
If hours and minutes are int type,
String.format("%d:%d", hours, minutes);
// or
String.format("%d:%d", new Object[]{hours, minutes});
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
Motiranjan>I am new to vc++.
This is JAVA forum. Post your problem in C++ forum.
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
String time = String.format("%d:%02d", hours, minutes);
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847