مستخدم:Gerges/وحدة:تجربة

local p = {}

function p.test( inputDate )

local year = tonumber(string.sub(inputDate, 1, 4))

local month = tonumber(string.sub(inputDate, 5, 6))

local day = tonumber(string.sub(inputDate, 7, 8))

local hour = tonumber(string.sub(inputDate, 9, 10))

local minute = tonumber(string.sub(inputDate, 11, 12))

local inputTime = os.time({year = year, month = month, day = day, hour = hour, min = minute})

local currentTime = os.time()

local timeDifference = os.difftime(currentTime, inputTime)

local hours = math.floor(timeDifference / 3600)

local minutes = math.floor((timeDifference % 3600) / 60)

return string.format("منذ %d ساعة و %d دقيقة", hours, minutes)

end

return p