New date();

Hi!

I started to learn actionscript for a few days ago, and now i started to learn date…

I have got some problem on the way so i hope you can help me.

    monthname = new Array();
    monthname[0] = "Januari";
    monthname[1] = "Februari";
    monthname[2] = "Mars";
    monthname[3] = "April";
    monthname[4] = "Maj";
    monthname[5] = "Juni";
    monthname[6] = "Juli";
    monthname[7] = "Augusti";
    monthname[8] = "September";
    monthname[9] = "Oktober";
    monthname[10] = "November";
    monthname[11] = "December";
    
    var date = new Date();
    
    year = date.getFullYear();
    date = date.getDate();
    month = monthname[date.getMonth()];
    day = date.getDay();
    hours = date.getHours();
    minutes = date.getMinutes();
    seconds = date.getSeconds();
    
    if(hours < 10)
    {
        hours = "0" + hours;
    }
    
    if(minutes < 10)
    {
        minutes = "0" + minutes;
    }
    
    if(seconds < 10)
    {
        seconds = "0" + seconds;
    }
        
    clock.text = seconds;


When i test it, I got this text: UNDEFINED

But if I write clock.text = date; It works
But why doesn’t seconds, hours, or minutes work

Thanks //WebbHelp

Hi

You are sing the same variable name for two different variables:

var date = new Date();
date = date.getDate();

Try for instance to change the name of the last one:
nDate = date.getDate();

-Nathalie