Jump to content

Convert Time


Z4Zy

Recommended Posts

Posted

Hi There !

         Below code draw a DX text with Real World Time.


function time ()
    local time = getRealTime()
	local hours = time.hour
	local minutes = time.minute
	dxDrawRectangle (112, 468, 134, 47, tocolor(0, 0, 0, 150))
	dxDrawText (hours..":"..minutes, 146, 476, 304, 536, tocolor(255,255,255), 2)
end
addEventHandler ( "onClientRender", root, time )

This time is in digital clock [ ex :- 1.30 PM ==> 13:30 , 6.00 PM ==> 18:00 ] And how to convert it to analog clock ??:S [ ex :- 13:30 ==> 1.30 PM , 18:00 ==> 6.00 PM ]

 

Posted

You mean it's 12 hours based and you want it 24 hours based?

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

Posted (edited)

He mean, if the Time in real world was 14:00 he want it to show as 2:00PM        And same from 2:00PM he want it to show as  14:00

Edited by SSKE
Posted
if (hour > 12) then
  hour = hour-12
end

Isn't it this simple?

From 00:00 to 12:00 that's morning, so it's AM, after 12:00 it's all PM

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

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