I am making a program that puts a zero before a day or month if its < 10. I work with the ternary operator and it works well if my dates are < 10.
11-02-1999 is good
But if its higher than zero it gives
11- 12-1999
I dont want that whitespace. How do i remove it. This is my code
nuldag = (dag < 10 ? '0' : '\0');
nulmonth = (month < 10 ? '0' : '\0');
System.out.println("Date is: " +nulday+day+"-"+nulmonth+month+"-"+year);
nuldaganddag, but you meannuldayandday.nuldaylater though, so you need to rename them to be the same.