Clock Date Function
 

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

Clock Date Function

Started by [SLUT]Blackbirdxxw, 25 March, 2004, 12:53:41

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[SLUT]Blackbirdxxw

If your date is not showing correct add this to the clock function in :


function showclock()
   dato = date()
   _,_,mm,dd,yy,ttt,mmm = strfind(dato, "(%d+)/(%d+)/(%d+)%s(%d+):(%d+)")
   local ddd = date("%A")
   mm = tonumber(mm)
   dd = tonumber(dd)
   
   if dd == 1 or dd == 21 or dd == 31 then
      suf = "st"
   elseif dd == 2 or dd == 22 then
      suf = "nd"
   elseif dd == 3 or dd == 23 then
      suf = "rd"
   else
      suf = "th"
   end

.......................................................................

function dotime(user,data)
   dato = date()
   _,_,mm,dd,yy,ttt,mmm = strfind(dato, "(%d+)/(%d+)/(%d+)%s(%d+):(%d+)")
   local ddd = date("%A")
   mm = tonumber(mm)
   dd = tonumber(dd)

   if dd == 1 or dd == 21 or dd == 31 then
      suf = "st"
   elseif dd == 2 or dd == 22 then
      suf = "nd"
   elseif dd == 3 or dd == 23 then
      suf = "rd"
   else
      suf = "th"
   end
......................................................................
This will sort your date out

Green Greetz To All
Big Hi to MAster @ Magmar

Herodes

I was dipping into the Mean_Machine by Snowman and I came across this func ...

I would like to know what would cause the date not to display propertly ..

I cant seem of a logical excuse ...

blackwings

#2
I use this script that shows the time in main and it shows the correct time. Because the time on the message it sends it times, is the same as the time stamp in DC. So maybe it isn't always wrong with how the script checks the time.
-- TimeBot by aMutex - 30.12.2002 
BotName = #Clock" 
TimeSpanInMinutes = 180 
function Main() 
SetTimer(TimeSpanInMinutes*60000) 
StartTimer() 
end 
function OnTimer() 
SendToAll(BotName, date("The time is %T in our hub local timezone.")) 
end


Herodes

Sure ... I'm cool with that ...
I still don't get it .. why would the date AND the time display "not show correct"? (as it is stated in this first post )

plop

QuoteOriginally posted by Herodes
Sure ... I'm cool with that ...
I still don't get it .. why would the date AND the time display "not show correct"? (as it is stated in this first post )
the only posible bug i know in this comes from the fact some ppl use the date() wrong.
many use time = date("%H")..:..date("%M").."."..date("%S").
but this can go wrong, best explained with an example.

it's 11:59.99 when you do date("%H"), this retrieves 11.
next the date("%M") is triggered, which should retrieve 59.
but if the time changed it can return 00.
the result is that time becomes 11:00, now thats an hour 2 late.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Herodes

Hehe :D
 thank u plop ... it was a sneaky one ...

this is what "experience" and "clear thinking" is all about ...
now it is definately clear...

SMF spam blocked by CleanTalk