Use printf to pad a value to a desired length:
printf '%06d\n' "$value" # pad with 0's
printf '%6d\n' "$value" # pad with spaces, right aligned
printf '%-6d\n' "$value" # pad with spaces, left aligned
If you're working with numbers it would be a bit unusual to strip of excess digits. But if you wanted to, you could display only the first 6:
printf '%06d\n' "${value::6}"