Jump to content

Code pls!!!!


Andu Jame

Recommended Posts

??? What are the code to make "time" in website, automatically follows the server time

the code i hv tried is:

<?

$today=date("F j,Y, g:i a");

echo date ("F j,Y, g:i a");

?>

 


this code make appear the time at my page but i'hv to refresh the page each time i open it..!!
Link to comment
Share on other sites

;DThanks a lot :D

Actually i am doing punch card system for two department, they are using bar code scanner.

Now,i have got problem with php code to controlling that two department to punch at same time but using only one server and two computers.It means, officer in department A can not punch card at department B and it same goes to officer in department B.

What should i do,Can u pls HELP me with that php or js code

Well..im really new to this programming.

 

Link to comment
Share on other sites

I did not get ur question completely but for u to explain...

 

Php is server side if u want to display date or time then u reload the page for that to get live time.

 

Javascript give live time running with seconds, so it is the most proper way to do it.

 

As my suggestion use js script for this type of situation.

 

If not clear can post for more explanation.

 

Try this code for real time.

 

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Craig Lumley -->
<!-- Web Site:  http://www.ws4all.co.uk -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function MakeArrayday(size) {
this.length = size;
for(var i = 1; i <= size; i++) {
this[i] = "";
}
return this;
}
function MakeArraymonth(size) {
this.length = size;
for(var i = 1; i <= size; i++) {
this[i] = "";
}
return this;
}
function funClock() {
if (!document.layers && !document.all)
return;
var runTime = new Date();
var hours = runTime.getHours();
var minutes = runTime.getMinutes();
var seconds = runTime.getSeconds();
var dn = "AM";
if (hours >= 12) {
dn = "PM";
hours = hours - 12;
}
if (hours == 0) {
hours = 12;
}
if (minutes <= 9) {
minutes = "0" + minutes;
}
if (seconds <= 9) {
seconds = "0" + seconds;
}
movingtime = "<b>"+ hours + ":" + minutes + ":" + seconds + " " + dn + "</b>";
if (document.layers) {
document.layers.clock.document.write(movingtime);
document.layers.clock.document.close();
}
else if (document.all) {
clock.innerHTML = movingtime;
}
setTimeout("funClock()", 1000)
}
window.onload = funClock;
//  End -->
</script>
</HEAD>

<BODY>

Currently, it's <span id=clock style="position:relative;"></span>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

Link to comment
Share on other sites

The time is working, I have another problem.

 

Actually im trying control two system working separately, that system using for punch card their attendance.

 

What are the code i should use?? To make that system works separate by using one server.

 

Should i control it by IP address??

Link to comment
Share on other sites

I am not sure about these things , but one thing in my mind is that the js code is client side,

If there is one min diff in the remote computer then it is easly controlled by one server.

I mean that the time in js is if u put on the client computer then ok if on server then i am not sure to do bcoz i

did not go for these things before, other u can try the IP address to catch the time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.