You wrote And none works in my case, such as "000101" it has 6 digits, but it either says 4 or 3. Any help?
if the integer was 000101 then the first 3 zeros would get removed, it would become 101.
If it was a string you just count how much letters in the string.
Seems you want to represent binary I would use bit array for this
Edit: Okay it's not binary it's a date which should be stored into string to avoid this Y2K bug.
int count = strlen("000101");