Problems / Seconds to HH:MM / Editorial
duration_seconds // 3600
(duration_seconds % 3600) // 60
lpad(part, 2, '0')
|| ':' ||
lpad is a *string* function with a fixed output length — it pads short input but also truncates long input. That makes the cast discipline matter: in PySpark, F.floor returns a double, so casting it straight to string yields "1.0", and lpad("1.0", 2, "0") truncates it to "1.". Cast to an integer type first. The duration_seconds // 3600 / % 3600 // 60 decomposition is the same trick used for any unit conversion (bytes → GB/MB, cents → dollars/cents).
lpad
F.floor
"1.0"
lpad("1.0", 2, "0")
"1."
% 3600 // 60
Solve Seconds to HH:MM yourself →