Jump to content

استفسار


MA[S]RIY

Recommended Posts

On ٩‏/٤‏/٢٠١٦ at 20:16, </Mr.Tn6eL> said:

وظيفة تقوم بارجاع الوقت الحقيقي وتحويله من 24 ساعة الى 12 ساعة

The function returns real time with convert 24h to 12h

Shared function

 


string getTime( ) 
 

 


function getTime( ) 
    local time = getRealTime( ) 
    local h, m = time.hour, time.minute 
    return (h % 12 and h % 12 or 12)..":"..(m < 10 and "0"..m or m).." "..(h >= 12 and "PM" or "AM") 
end 
 

 

 

Link to comment

مثال :

function getTime( )

    local time = getRealTime( )

    local h, m = time.hour, time.minute

    return (h % 12 and h % 12 or 12)..":"..(m < 10 and "0"..m or m).." "..(h >= 12 and "PM" or "AM")

end

addCommandHandler ( 'whatTimeIsIt', function ( )

    outputChatBox ( 'Its ( ' .. getTime ( ) .. ' )' )

end )

 

Link to comment

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...