How can i fix my code for a clock on flash?

  • Thread starter Thread starter sfari89
  • Start date Start date
S

sfari89

Guest
this.onEnterFrame = function ()
{
time = new Date();
var minutes = time.getMinutes();
var hours = time.getHours();
if (hours < 12)
{
ampm="am";
}
if (hours >12)
{
ampm="pm"
}
if (hours <1)
{
hours= "12"
ampm= "am"
}
if (hours==12)
{
ampm="pm"
}
if (hours>12)
{
hours= hours-12
}
if (minutes < 10)
{
minutes = "0" + minutes;
}
clock_txt.text = hours + ":" + minutes + ampm ;
}

when it is 12:00 am it says 12:00 pm
can you explain what you changed and how that will fix it?
 
{
time = new Date();
var minutes = time.getMinutes();
var hours = time.getHours();
if (hours < 12)
{
ampm="pm";
}
if (hours >12)
{
ampm="am"
}
if (hours <1)
{
hours= "12"
ampm= "pm"
}
if (hours==12)
{
ampm="am"
}
if (hours>12)
{
hours= hours-12
}
if (minutes < 10)
{
minutes = "0" + minutes;
}
clock_txt.text = hours + ":" + minutes + ampm ;
}
 
Back
Top