# PHP Time

**URL:** https://forum.kirupa.com/t/php-time/204081
**Category:** flash
**Created:** [October 17, 2006, 12:13am UTC](https://forum.kirupa.com/t/php-time/204081 "2006-10-17T00:13:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ery101](https://avatars.discourse-cdn.com/v4/letter/e/a5b964/32.png) [@ery101](https://forum.kirupa.com/u/ery101)
#### Post date: [October 17, 2006, 12:13am UTC](https://forum.kirupa.com/t/php-time/204081/1 "2006-10-17T00:13:25Z")

</div>

Hey everyone, I’ve been using the flash countdown tutorial on my site for quite some time now and I just recently (today) made it to where its counting down to a specific time on a specific date, so to do this I just altered the code to include the hour, minute, and second of the event. Anyway, I needed this to be the same around the world (in all timezones) so I went with the php way to where its getting the time from the file on my site’s server… everything seems to work fine until I asked someone in Australia what the counter said, it was 15 hours off. I tested this by setting my clock to eastern time (im central) and it does show one hour off.

So for some reason its not working. Any ideas?

Here’s the actionscript code:

```auto
stop();

eventDate = new Date(2006, 9, 24, 13, 59, 40, 50);
eventMillisecs = eventDate.getTime();

countdown = function(){

    var currentMillisecs = server.time + getTimer();

    this.msecs = eventMillisecs - currentMillisecs;

    if (this.msecs <= 0){

        play();

        return;
    }

    this.secs = Math.floor(this.msecs/1000);
    this.mins = Math.floor(this.secs/60);
    this.hours = Math.floor(this.mins/60);
    this.days = Math.floor(this.hours/24);

    this.msecs = string(this.msecs % 1000);
    this.secs = string(this.secs % 60);
    this.mins = string(this.mins % 60);
    this.hours = string(this.hours % 24);
    this.days = string(this.days);

    while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
    if (this.secs.length < 2) this.secs = "0" + this.secs;
    if (this.mins.length < 2) this.mins = "0" + this.mins;
    if (this.hours.length < 2) this.hours = "0" + this.hours;
    while (this.days.length < 3) this.days = "0" + this.days;

    for(movie in this){
        if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
    }
};

MovieClip.prototype.evaluateFrameFrom = function(variableClip){
    var nameArray = this._name.split("_");
    var numberSet = variableClip[nameArray[0]];
    var character = number(nameArray[1]);
    var frame = 1 + number(numberSet.charAt(character));
    if (this._currentframe != frame) this.gotoAndStop(frame);
};

server = new LoadVars();
server.onLoad = function(ok){
    if (!ok) return trace("Server error! Unable to obtain date from server");
    counter.onEnterFrame = countdown;
    counter._visible = true;
    this.time = Number(this.time)*1000 - getTimer();
};
server.load("gettime.php");

counter._visible = false;

```

And the php file’s code:

```auto
<?php
echo "time=" . time();
?>

```

You can see it and test it out on [24fans.net](http://24fans.net)

Thanks.
