Multi Time Zone Message
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Multi Time Zone Message

Started by -3sixty-, 06 May, 2005, 03:06:58

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-3sixty-

can anyone make me a script that displays the hub time and other timezones ??

e.g.

hub time: 02:06 [gmt]
sweden:  03:06
india     :  06:35

Dessamator

it has been done already, search the forum !!
Ignorance is Bliss.

-3sixty-

i have looked  ?(  where is it please

Dessamator

hmm, sorry i thought it already existed,
hubtime is simple to do, now other timezones that would b a bit challenging, theres quite a lot of countries in the world, even though they all follow a pattern, ud need to have a reference for all of them, or do u just want it for each continent?
Ignorance is Bliss.

-3sixty-

i would only add the timezones of the people in my hub, i only run a small hub for friends, so i would have the swedish time, finnish time, british time, hongkong and india

doesnt sound easy does it

Dessamator

not very hard, btw, can u give me the timezones for each of those, in comparison to gmt ?
Ignorance is Bliss.

Dessamator

#6
--Timezone script 
--Requested by -3sixty-
--By Dessamator
--Cmds : !time & !timezone
-- Config --

urTime="2" -- ur local time in comparison to GMT
bot=frmHub:GetHubBotName() -- ur bot name

--The timezones for each country 
tTimeZone = {
	["Britain"] = 0, 
	["Honk Kong"] = 8,
	["Sweden"] = 2,
	["Finland"] = 3,
	["India"] = 3,
	["Hub Time"] = urTime,
	}
-- Config End--

function ChatArrival(user,data)
local temp,hour ="\r\n\t\t".."Timezones: ".."\r\n".."\t".."Country".."\t\t\t".."Time".."\r\n\t"..string.rep("??",16).."\r\n",(os.date("%H"))
	if hour== 0 or 1 then
		hour=24-urTime
	else
		hour=(os.date("%H"))-urTime	
	end
	data=string.sub(data,1,string.len(data)-1)
	local s,e,cmd = string.find(data,"%b<>%s+(%S+)")

	if cmd =="!time" then
				user:SendPM(bot,os.date("The Current time is : %X"))
		return 1
	elseif cmd=="!timezone" then
		for country,time in tTimeZone do
			if string.len(country)<=8 then
				if hour+time>24 then
					temp = temp.."\t"..country.."\t\t\t"..os.date(("24"-hour+time)..":".."%M:%S".."\r\n")	
				else
					temp = temp.."\t"..country.."\t\t\t"..os.date(hour+time..":".."%M:%S".."\r\n")
				end
			end
			if string.len(country)>=8 then
				if hour+time>24 then
					temp = temp.."\t"..country.."\t\t"..os.date("24"-hour+time..":".."%M:%S".."\r\n")
				else
					temp = temp.."\t"..country.."\t\t"..os.date(hour+time..":".."%M:%S".."\r\n")
				end
			end
		end
	user:SendPM(bot,temp)
	return 1
	end
end

ToArrival = ChatArrival


Done !!
Ignorance is Bliss.

Dessamator

#7
--Timezone script 
--Requested by -3sixty-
--By Dessamator
--modded(Cleaning up) by Jiten
--Cmds : !time & !timezone

-- Config --

uTime="12" -- difference between ur time and GMT
bot = frmHub:GetHubBotName() -- ur bot name

--The timezones for each country 
tTimeZone = {
	["Britain"] = 0, 
	["Honk Kong"] = 8,
	["Sweden"] = 2,
	["Finland"] = 3,
	["India"] = 3,
	["Hub Time"] = uTime,
}
-- Config End--

function ChatArrival(user,data)
	local data=string.sub(data,1,-2)
	local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
	local temp,GMT = "\r\n\t\t".."Timezones: ".."\r\n".."\t".."Country".."\t\t\t".."Time".."\r\n\t"..string.rep("??",16).."\r\n", (os.date("%H")) - uTime
	if GMT < 0 then GMT = 24 - uTime + (os.date("%H")) end
	if cmd =="!time" then
		user:SendData(bot,os.date("The Current time is : %X"))
		return 1
	elseif cmd=="!timezone" then
		for country,time in tTimeZone do
			local tab = "\t\t\t" 
			if string.len(country) >=8 then tab = "\t\t" end
			temp = temp.."\t"..country..tab..os.date(GMT+time..":".."%M:%S".."\r\n")	
		end
		user:SendData(bot,temp)
		return 1
	end
end

ToArrival = ChatArrival
Ignorance is Bliss.

jiten

Heya Dessamator. Small fix in the code:
if GMT < 0 then GMT = 24 - uTime - 1 end
to
if GMT < 0 then GMT = 24 - uTime + (os.date("%H")) end
Cheers

Dessamator

QuoteOriginally posted by jiten
Heya Dessamator. Small fix in the code:
if GMT < 0 then GMT = 24 - uTime - 1 end
to
if GMT < 0 then GMT = 24 - uTime + (os.date("%H")) end
Cheers

Done !
Ignorance is Bliss.

SMF spam blocked by CleanTalk