I want my program to concat String variables (Date->int->String) but with a minus (-) sign between the Strings that I want to merge. For example: StringA + "-" + StringB
or StringA.concat("-").concat(StringB)
. But if String a="100"
and StringB="200"
the operation would return me "-100" instead of "200-100".
Why is this? Does String somehow converts Strings to int and then executes mathematical operations? No sense.
Code:
DateTime dt = new DateTime();
int sYear = dt.getYear();
int sMonth = dt.getMonthOfYear();
String minDate = null;
String y = Integer.toString(sYear);
String m = Integer.toString(sMonth);
minDate = y + "-" + m + "-01"; //or y.concat("-").concat(m).concat("-01");
The example I have above returns 1715.