diff --git a/smradius/modules/accounting/mod_accounting_sql.pm b/smradius/modules/accounting/mod_accounting_sql.pm
index fe1c6c34bc020d048f4b6108ecefab5241f231ef..6469cf14f067181a125a6f3e53c08b8d076140ef 100644
--- a/smradius/modules/accounting/mod_accounting_sql.pm
+++ b/smradius/modules/accounting/mod_accounting_sql.pm
@@ -412,7 +412,7 @@ sub cleanup
 		# Set array items
 		@recordRow = (
 			$usageTotals->{'Username'},
-			$lastMonth->year."-".$lastMonth->month,
+			$lastMonth->ymd,
 			$usageTotals->{'AcctSessionTime'},
 			$usageTotals->{'AcctInputOctets'},
 			$usageTotals->{'AcctInputGigawords'},