# New date();

**URL:** <https://forum.kirupa.com/t/new-date/264174>\
**Category:** Uncategorized\
**Created:** [June 23, 2008, 7:28pm UTC](https://forum.kirupa.com/t/new-date/264174 "2008-06-23T19:28:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![webbhelp](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@webbhelp](https://forum.kirupa.com/u/webbhelp)\
**Post date:** [June 23, 2008, 7:28pm UTC](https://forum.kirupa.com/t/new-date/264174/1 "2008-06-23T19:28:57Z")

</div>

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.

```auto
    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

---

<div class="post-metadata">

**Author:** ![Nattis](https://avatars.discourse-cdn.com/v4/letter/n/f0a364/32.png) [@Nattis](https://forum.kirupa.com/u/Nattis)\
**Post date:** [June 24, 2008, 7:23am UTC](https://forum.kirupa.com/t/new-date/264174/2 "2008-06-24T07:23:29Z")

</div>

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
