PDA

View Full Version : Digital Clock


Dudeking
11-15-2007, 02:26 PM
http://beta.dudeking.co.uk/image.php

I just like posting things here lol, i dont know why...

But anyway...digital clock...with the right GMT time

Dudeking
11-15-2007, 02:54 PM
I'm trying to make a config page for it now to change colours and the time zone. I'll post when its done :D

PeteF
11-15-2007, 06:34 PM
http://beta.dudeking.co.uk/image.php

I just like posting things here lol, i dont know why...

But anyway...digital clock...with the right GMT time

Hey Dudeking, I like that clock display!
I gave me an idea that might help the KH Forums promote the Paltalk sessions.

Problem is that we have people from several timezones here at KH
and when it's time to post an announcement that the Paltalk session
will be open there is a need to post the time in the different time
zones.

So I'm wondering how hard it would be to develop some PHP code
that would enable someone to insert some simple HTML code
to a post here at KH that would display a fixed time in in several
time zones.

..12:00pm......2:00pm......7:00pm.....4:00am...
.USA-West...USA-East...UK-London...Australia.

The HTML code might look something like this below and
the resulting images would display as shown above.
[ I M G ] h t t p : //beta.dudeking.co.uk/TimezonesImages.php 12:00 pm[ / I M G ]

Is that a big job?
I'm pretty sure the admins here involved with Paltalk could use it. Correct?

---pete---

Dudeking
11-15-2007, 06:50 PM
That's prity simple pete.

I'll have a go now for you :) It's getting late over here so I probily wont post untill the morning now

Dudeking
11-16-2007, 05:57 AM
http://safeinaroom.co.uk/khclock/

I'm working on a countdown script now so it says how long till its open and says room open between the opening hours.

But thats the first version, any comments would be great thanks.

Wolfeymole
11-16-2007, 06:53 AM
Hey Dudeking, I like that clock display!
I gave me an idea that might help the KH Forums promote the Paltalk sessions.

Problem is that we have people from several timezones here at KH
and when it's time to post an announcement that the Paltalk session
will be open there is a need to post the time in the different time
zones.

So I'm wondering how hard it would be to develop some PHP code
that would enable someone to insert some simple HTML code
to a post here at KH that would display a fixed time in in several
time zones.

..12:00pm......2:00pm......7:00pm.....4:00am...
.USA-West...USA-East...UK-London...Australia.

The HTML code might look something like this below and
the resulting images would display as shown above.
[ I M G ] h t t p : //beta.dudeking.co.uk/TimezonesImages.php 12:00 pm[ / I M G ]

Is that a big job?
I'm pretty sure the admins here involved with Paltalk could use it. Correct?

---pete---

Without wishng to cast aspersions on DK's programming have you seen the rough guide I made Pete?
Very basic but does the job.
http://www.kickenhardware.net/forum/showthread.php?p=60042

Wolfeymole
11-16-2007, 07:58 AM
Not catered for mate sorry. :frown: :D

PeteF
11-16-2007, 12:32 PM
http://safeinaroom.co.uk/khclock/

I'm working on a countdown script now so it says how long till its open and says room open between the opening hours.

But thats the first version, any comments would be great thanks.

Wow, that's excellent!
You sure act fast!

Edit...
opps, I spoke too soon.
I thought the times listed from left to right were the Opening times in the different time zones
but you have them as the current time. The times in the different zones should be fixed
times indicating the start time that the Paltake session opens.

You can have a separate single countdown clock that displays the number of hour & minutes
until the doors open, but you only need to display one clock for that since it would apply
to everyone, regardless of what time zone they are in.

---pete---

PeteF
11-16-2007, 12:38 PM
Without wishng to cast aspersions on DK's programming have you seen the rough guide I made Pete?
Very basic but does the job.
http://www.kickenhardware.net/forum/showthread.php?p=60042

Wolfey, I never saw that one before.
It looks pretty good and will get the job done, no doubt.

However, if DudeKing can come up with the program as I
suggested, it would be much simpler because anyone could
post a link with a single start time and the program would
automaticlly display all the timezones.

---pete---

kern
11-16-2007, 12:50 PM
http://safeinaroom.co.uk/khclock/

I'm working on a countdown script now so it says how long till its open and says room open between the opening hours.

But thats the first version, any comments would be great thanks.

Very nice indeed! Now we have another item on the to do list....

Dudeking
11-17-2007, 06:06 PM
If i add the start times to that what does every one think? Closed changed to open automaticly from 2-4 then from 9-12 US East time every wednesday.

kern
11-17-2007, 09:29 PM
If i add the start times to that what does every one think? .

sounds good.

PeteF
11-18-2007, 01:47 AM
Looks excellent now!

It looks so good I can imagine it posted as a banner on the top of the forums page.

Nice work Dudeking!

---pete---

Dudeking
11-18-2007, 07:52 AM
Thats it with the start times on

Dudeking
11-18-2007, 07:53 AM
Oh and just encase anyone wants to check the code

<?php
header('Content-type: image/png');
$im = imagecreatefrompng("background.png");
$font = imageloadfont("anonymous.gdf");
$white = imageColorAllocate ($im, 255,255,255);
$black = imageColorAllocate ($im, 0,0,0);
$red = imageColorAllocate ($im, 255,0,0);
$green = imageColorAllocate ($im, 0,255,0);

$hour = date('H', mktime());
$day = date("D");
if($day = "Wed"){
switch($hour){
case 18:
case 19:
case 20:
imagestring($im,$font,115,55,"Open",$green);
break;
default:
imagestring($im,$font,115,55,"Closed",$red);
break;
}
}elseif($day = "Thu"){
switch($hour){
case 02:
case 03:
imagestring($im,$font,115,55,"Open",$green);
break;
default:
imagestring($im,$font,115,55,"Closed",$red);
break;
}
}else{
imagestring($im,$font,115,55,"Closed",$red);
}

$timezone_local = array('-7','-5','-0','+1','+11');
$start_time = array('21.00','23.00','02.00','03.00','13.00');
$day = array('Wed','Wed','Thu','Thu','Thu');
$number = 0;
$position = 10;
foreach($timezone_local as $value){
$time = time();
$timezone_offset = date("Z");
$timezone_add = round($timezone_local[$number]*60*60);
$time = round($time-$timezone_offset+$timezone_add);
$date = date("H:i", $time);
imagestring($im,5,$position,180,$date,$black);
imagestring($im,5,$position,127,$start_time[$number],$black);
imagestring($im,1,$position+15,140,$day[$number],$black);
$position = $position + 58;
$number ++;
}
imagePNG ($im);
imageDestroy ($im);
?>

Wolfeymole
11-18-2007, 10:05 AM
Good script DK, you would have done well working in machine code 20 years ago.
:thumb: mate.

PeteF
11-18-2007, 12:14 PM
Oh and just encase anyone wants to check the code


Thanks for posting the code, for server side apps, I program in PERL
at novice level and I was wondering how the PHP code looked in comparison.

---pete---

mommalina
11-18-2007, 02:53 PM
Shouldn't there be a 3-hour difference between US west and US east?


Lina

Dudeking
11-18-2007, 04:54 PM
Some one will have to confirm the start times for me. They can be changed with in seconds.

Wolfeymole
11-19-2007, 12:57 PM
In relation to GMT Relz Helsinki or Espoo is +2 hours, would you like me to include that in the Excel sheet I made earlier?

This way DK can work off thoses times when making the digital clock perhaps.

Just a thought.

Wolfeymole
11-19-2007, 01:26 PM
Ok so your time now is roughly 20:25 or 8:25PM yes?

But surely, like us you put your clocks forward in summer by 1 hour and back by 1 hour in winter.