Jump to content

x[back]x


Recommended Posts

Posted

يعيال لا هنتم ابي كود يحول من الثواني الى

دقايق-ساعات-ايام-اسسابيع-شهور-سنين

اللي عنده لا يبخل علينا غريبه ذي صح لكن قلت اغير الروتين بدال

ما اشغل مخي اطلب من الحلوين الطيبين مثلكم

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted
29 minutes ago, coNolel said:

دقائق : *60

ساعات 60*60

أيام 60*60*24

أسابيع

7*60*60*24

شهور

7*60*60*24*عدد الأشهر

... سنوات إلخ

انت مضيع انا ابي يوزفل فنكشن ترا اعرف احول والله ذذ

19 minutes ago, Abdul KariM said:

ذا يجيب تاريخ اليوم انا ابي تحويل من ثواني لدقايق

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted
function secondsToTimeDesc( seconds )
	if seconds then
		local results = {}
		local sec = ( seconds %60 )
		local min = math.floor ( ( seconds % 3600 ) /60 )
		local hou = math.floor ( ( seconds % 86400 ) /3600 )
		local day = math.floor ( seconds /86400 )
		if day > 0 then table.insert( results, day .. ( day == 1 and " day" or " days" ) ) end
		if hou > 0 then table.insert( results, hou .. ( hou == 1 and " hour" or " hours" ) ) end
		if min > 0 then table.insert( results, min .. ( min == 1 and " minute" or " minutes" ) ) end
		if sec > 0 then table.insert( results, sec .. ( sec == 1 and " second" or " seconds" ) ) end
 
		return string.reverse ( table.concat ( results, ", " ):reverse():gsub(" ,", " dna ", 1 ) )
	end
	return ""
end

 

Chillin' with some demons, satans and vamps

Posted
8 minutes ago, #x1AhMeD,-09 said:

function secondsToTimeDesc( seconds )
	if seconds then
		local results = {}
		local sec = ( seconds %60 )
		local min = math.floor ( ( seconds % 3600 ) /60 )
		local hou = math.floor ( ( seconds % 86400 ) /3600 )
		local day = math.floor ( seconds /86400 )
		if day > 0 then table.insert( results, day .. ( day == 1 and " day" or " days" ) ) end
		if hou > 0 then table.insert( results, hou .. ( hou == 1 and " hour" or " hours" ) ) end
		if min > 0 then table.insert( results, min .. ( min == 1 and " minute" or " minutes" ) ) end
		if sec > 0 then table.insert( results, sec .. ( sec == 1 and " second" or " seconds" ) ) end
 
		return string.reverse ( table.concat ( results, ", " ):reverse():gsub(" ,", " dna ", 1 ) )
	end
	return ""
end

 

انته راجل 100% وانا غبي في الحسابات xD 

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted

@Master_MTA انا مشبه عليها لكن هذي الوظيفة الاصلية

On ٢٦‏/١٠‏/٢٠١٥ at 00:52, #CroSs said:

 

60727218.png

FormatTime

. هذه الوظيفة تقوم بتحويل الوقت أو حسابه وترجع جدول مع سترنق

Syntax

 

 

 


table, string FormatTime( float Time, string TimeFormula, bool Convert, string MaximumTimeFormula, table BannedTimeFormulas ) 
 

 

Required Arguments

  • Time : الوقت

 

 

  • TimeFormula : ..صيغة الوقت مثل ثانية ، ساعة ، يوم ، سنة ، الخ

Optional Arguments

  • Convert : . false ينحسب + القيمة الافتراضية هي false يتحول و true ، قيمة منطقية قائمة على أن الوقت المعطاه بيتحول أو بينحسب

 

 

  • MaximumTimeFormula : ...
    . ( قرن ) century القيمة الافتراضية هي + hour أعلى صيغة وقت الوظيفة راح تحسب بها ، يعني مثلاً تبي تحسب بالساعات فقط ، حط

 

 

  • BannedTimeFormulas : . صيغ الوقت إلي بتنحذف من جدول الوقت + ما راح تظهر في السترنق إلي يرجع ، طبعًا تحط الصيغ إلي تبي تحذفها في جدول + الافتراضي أنه يطلع الكل إذا كان قيمتهم مو صفر

 

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

صيغ الوقت المدعومة

( picosecond, nanosecond, microsecond, millisecond, centisecond, decisecond, second, minute, hour, day, week, month, year, decade, century )

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

 

 

Returns

 

  • . إذا صار خطأ false ترجع جدول فيه الوقت وسترنق فيه الوقت كـ كلام ، ويرجع

 

Source Code

 

 


function FormatTime( Time, TimeFormula, Convert, MaximumTimeFormula, BannedTimeFormulas ) 
    if ( type( Time ) == "number" and type( TimeFormula ) == "string" ) then 
        local SomeTable = { picosecond = Time / 1000000000000, nanosecond = Time / 1000000000, microsecond = Time / 1000000, 
            millisecond = Time / 1000, centisecond = Time / 100, decisecond = Time / 10, second = Time, minute = Time * 60, hour = Time * 3600, 
            day = Time * 86400, week = Time * 604800, month = Time * 2592000, year = Time * 31536000, decade = Time * 315360000, century = Time * 3153600000 
        } 
        MaximumTimeFormula = string.lower( tostring( MaximumTimeFormula ) ) 
        Time, MaximumTimeFormula = SomeTable[string.lower( TimeFormula )], SomeTable[MaximumTimeFormula] and MaximumTimeFormula or "century" 
        if ( Time ) then 
            local TimeTable, Time, String, Convert = {}, math.abs( Time ), "", not Convert 
            TimeTable["picosecond"] = math.floor( Convert and MaximumTimeFormula ~= "picosecond" and Time * 1000000000000 % 10 or Time * 1000000000000 ) 
            TimeTable["nanosecond"] = math.floor( Convert and MaximumTimeFormula ~= "nanosecond" and Time * 1000000000 % 10 or Time * 1000000000 ) 
            TimeTable["microsecond"] = math.floor( Convert and MaximumTimeFormula ~= "microsecond" and Time * 1000000 % 10 or Time * 1000000 ) 
            TimeTable["millisecond"] = math.floor( Convert and MaximumTimeFormula ~= "millisecond" and Time * 1000 % 10 or Time * 1000 ) 
            TimeTable["centisecond"] = math.floor( Convert and MaximumTimeFormula ~= "centisecond" and Time * 100 % 10 or Time * 100 ) 
            TimeTable["decisecond"] = math.floor( Convert and MaximumTimeFormula ~= "decisecond" and Time * 10 % 10 or Time * 10 ) 
            TimeTable["second"] = math.floor( Convert and MaximumTimeFormula ~= "second" and Time % 60 or Time ) 
            TimeTable["minute"] = math.floor( Convert and MaximumTimeFormula ~= "minute" and Time % 3600 / 60 or Time / 60 ) 
            TimeTable["hour"] = math.floor( Convert and MaximumTimeFormula ~= "hour" and Time % 86400 / 3600 or Time / 3600 ) 
            TimeTable["day"] = math.floor( Convert and MaximumTimeFormula ~= "day" and Time % 31536000 % 2592000 % 604800 / 86400 or Time / 86400 ) 
            TimeTable["week"] = math.floor( Convert and MaximumTimeFormula ~= "week" and Time % 2592000 / 604800 or Time / 604800 ) 
            TimeTable["month"] = math.floor( Convert and MaximumTimeFormula ~= "month" and Time % 31536000 / 2592000 or Time / 2592000 ) 
            TimeTable["year"] = math.floor( Convert and MaximumTimeFormula ~= "year" and Time % 315360000 / 31536000 or Time / 31536000 ) 
            TimeTable["decade"] = math.floor( Convert and MaximumTimeFormula ~= "decade" and Time % 3153600000 / 315360000 or Time / 315360000 ) 
            TimeTable["century"] = math.floor( Time / 3153600000 ) 
            local TimeFormulas = { "picosecond", "nanosecond", "microsecond", "millisecond", "centisecond", "decisecond", "second", "minute", "hour", "day", "week", "month", "year", "decade", "century" } 
            for _, TimeFormula in next, TimeFormulas, ( { picosecond = 1, nanosecond = 2, microsecond = 3, millisecond = 4, centisecond = 5, decisecond = 6, second = 7, minute = 8, hour = 9, day = 10, week = 11, month = 12, year = 13, decade = 14 } )[MaximumTimeFormula] or 15 do TimeTable[TimeFormula] = nil end 
            if ( type( BannedTimeFormulas ) == "table" ) then for _, TimeFormula in ipairs( BannedTimeFormulas ) do TimeTable[string.lower( TimeFormula )] = nil end end 
            for _, TimeFormula in ipairs( { "century", "decade", "year", "month", "week", "day", "hour", "minute", "second", "decisecond", "centisecond", "millisecond", "microsecond", "nanosecond", "picosecond" } ) do 
                local Time = TimeTable[TimeFormula] 
                if ( Time and Time ~= 0 ) then 
                    TimeFormula = string.upper( string.sub( TimeFormula, 1, 1 ) )..string.sub( TimeFormula, 2, #TimeFormula )..( Time == 1 and "" or "s" ) TimeFormula = TimeFormula == "Centurys" and "Centuries" or TimeFormula 
                    String = ( String == "" and String or String..( Convert and " and " or ", " ) )..( Convert and Time.." "..TimeFormula or TimeFormula.." = "..Time ) 
                end 
            end 
            return TimeTable, String..( String ~= "" and " ." or "" ) 
        end 
        return false 
    end 
    return false 
end 
 

 

 

Example

 

 


print( select( -1, FormatTime( 10, "Day" ) ) ) --> 1 Week and 3 Days . الحساب print( select( -1, FormatTime( 10, "Decisecond" ) ) ) --> 1 Second . الحساب print( select( -1, FormatTime( 1, "Second", true ) ) ) --> Second = 1, Deciseconds = 10, Centiseconds = 100, Milliseconds = 1000, Microseconds = 1000000, Nanoseconds = 1000000000, Picoseconds = 1000000000000 . -- التحويل print( select( -1, FormatTime( 2.6, "day", nil, "hour" ) ) --> 62 Hours and 24 Minutes . --> hour الحساب + أعلى صيغة هي print( select( -1, FormatTime( 2.6, "day", nil, "hour", { "minute" } ) ) --> 62 Hours . --> شلنا الدقائق من الجدول والسترنق + hour الحساب + أعلى صيغة 
 

Author : #CroSs

:fadein: .

 

[ Skype : kreee89 - Discord : Abdul_KariM#1326 / طلبات البرمجة

https://www.paypal.me/AbdulKariMx / اذا حاب تدعمني

Posted
24 minutes ago, Abdul KariM said:

@Master_MTA انا مشبه عليها لكن هذي الوظيفة الاصلية

مشكور يا بعدي

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...