Jump to content

hora actual


tacurtir

Recommended Posts

Boas a todos...

tenho um problema em apresentar a hora actual...quando corro o swf no meu pc(so windows) é apresentada a hora actual (dinamicamente)...mas quando passo o swf para um pc com linux nao apresenta nada so a minha imagem de fundo...

estou a actualizar este script:

this.onEnterFrame = function ()

{

da = new Date();

ho = da.getHours();

mi = da.getMinutes();

se = da.getSeconds();

h = ho < 10 ? ("0" + ho) : (ho);

m = mi < 10 ? ("0" + mi) : (mi);

s = se < 10 ? ("0" + se) : (se);

hora.text = h + ":" + m + ":" + s;

};

alguma ajuda agradeço...

Link to comment
Share on other sites

  • 3 weeks later...

experimenta com este código.. .tinha isto aqui nuns testes...

this.onEnterFrame = function (){
trace(getCurrentTime(new Date()));
}

function getCurrentTime(mdate:Date):String{
seconds = mdate.getSeconds();
minutes = mdate.getMinutes();
hours = mdate.getHours();


if (hours>12) {
	hours = hours-12;
	ampm = "PM";
} else {
	ampm = "AM";
}
if (hours == 0) {
	hours = 12;
}
if (minutes<10) {
	minutes = "0"+minutes;
}
if (seconds<10) {
	seconds = "0"+seconds;
}

return ((hours) + ":" + (minutes) + ":" + (seconds) + " " + (ampm));;

}


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.